Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 21, 2025. It is now read-only.
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

Copy link
Copy link

Description

@juxtin
Issue body actions

馃憢 from the Dependency Graph team at GitHub!

Last week, we shipped support for submitted dependencies in dependency review.

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.