Skip to content

ci: make commit sha consistent across workflows #680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2025

Conversation

dianjuar
Copy link
Member

@dianjuar dianjuar commented Jan 12, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

What is the current behavior?

Issue Number: #671

Turns out what:

Yes, git log -1 --format=%H should be equal to github.sha in the CI runtime if you're running the workflow on the same commit. However, there are a few scenarios where they might not match:

  • Pull Request workflows: GitHub creates a merge commit by merging your branch with the target branch. In this case:
    • Your local: your-branch-commit
    • GitHub Actions: temporary-merge-commit

What is the new behavior?

The new behavior ensures that the commit SHA is consistent across different GitHub Actions workflows. This addresses scenarios in pull request workflows where GitHub creates a temporary merge commit, causing discrepancies between the local branch commit SHA and the one used in the GitHub Actions environment. As a result, the commit SHA will now reliably match between the local branch and the CI runtime, preventing inconsistencies and potential issues in the workflows.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@dianjuar dianjuar force-pushed the fix-sonar-for-contributors branch 2 times, most recently from 0bc080a to 006aec4 Compare January 12, 2025 02:58
@dianjuar dianjuar force-pushed the fix-sonar-for-contributors branch from 006aec4 to 9ce296d Compare January 12, 2025 03:06
@dianjuar dianjuar merged commit 5859bec into main Jan 12, 2025
6 checks passed
@dianjuar dianjuar deleted the fix-sonar-for-contributors branch January 12, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant