You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 21, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 21, 2025. It is now read-only.
Dependency snapshot should use pull_request.head.sha when available #882
For the most part, this action seems to already do everything necessary to work properly with dependency review, but there is one tiny exception.
What we're asking
$GITHUB_SHA should be set to the value of github.event.pull_request.head.sha whenever that variable is populated, i.e. when in the context of a pull request.
Why
When submitting a snapshot, https://github.com/gradle/github-dependency-graph-gradle-plugin uses the $GITHUB_SHA environment variable as the SHA of the dependency snapshot. This is perfectly correct for push events, but unfortunately it's not the value we need for pull_request events. In a pull request, GITHUB_SHA is set to the "last merge commit on the GITHUB_REF branch", which is sadly irrelevant to the dependency graph.
Instead, we should submit a snapshot for the head SHA of the PR, which can be extracted from the pull_request object with the equivalent of github.event.pull_request.head.sha.
Actions that use our official javascript dependency-submission-toolkit get this fix for free, but that doesn't apply to github-dependency-graph-gradle-plugin. In that case, we're limited to setting the SHA by overriding the $GITHUB_SHA env var as described in the docs.
You can see how we get the right value in the toolkit here for reference.
Reacted by Daz DeBoer, Philip Wedemann and MuhittinTekin
Activity
Use correct SHA for pull request events
Use correct SHA for pull request events