Skip to content
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

Dependency Review #135

Closed
MPV opened this issue Oct 16, 2023 · 11 comments · Fixed by #140
Closed

Dependency Review #135

MPV opened this issue Oct 16, 2023 · 11 comments · Fixed by #140

Comments

@MPV
Copy link
Contributor

MPV commented Oct 16, 2023

Does this action work together with GitHub's Dependency Review?

See:

@adpi2
Copy link
Member

adpi2 commented Oct 17, 2023

There is a note in Dependency review enforcement stating that it should work:

Note: The dependency review API and the dependency submission API work together. This means that the dependency review API will include dependencies submitted via the dependency submission API. This feature is currently in public beta and subject to change.

If anyone knows how to set them up, we could add it as an example in the README.md.

@MPV
Copy link
Contributor Author

MPV commented Nov 6, 2023

A basic example (in my mind) should be) — would you agree?

name: Dependency Review

on:
  push:
    branches:
      - master
  pull_request:

permissions:
  contents: write # for submitting dependency graph

jobs:
  dependency-review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: scalacenter/sbt-dependency-submission@v2
      - uses: actions/dependency-review-action@v3
        if: github.event_name == 'pull_request'

@MPV
Copy link
Contributor Author

MPV commented Nov 6, 2023

Here is my example live:

However I haven't gotten it to work yet, as actions/dependency-review-action prints things as:

  1. No snapshots were found for the head SHA d4763439a5e5d2b08ddc3cf0d01ab3debb988654.
  2. Dependency Changes being empty.

...as seen here:


So while the dependencies are properly uploaded from master and shown here...

...and they seem to work fine to submit from the PR/branch too, but I don't see actions/dependency-review-action detecting them yet.

@MPV
Copy link
Contributor Author

MPV commented Nov 6, 2023

I have a theory what makes it not work in PRs, as mentioned in upstream issue (to be confirmed):

Looks to me it’s using the GITHUB_SHA:

Should it be using something like github.event.pull_request.head.sha instead (if called from a PR)?

As per:

See:

@adpi2
Copy link
Member

adpi2 commented Nov 6, 2023

If I understand correctly we should use github.event.pull_request.head.sha, when it is available, instead of GITHUB_SHA. @MPV would you like to contribute?

@MPV
Copy link
Contributor Author

MPV commented Nov 6, 2023

Seems workaround doesn't work:

...so some kind of code change here will be needed here, not sure which exact change.

@adpi2
Copy link
Member

adpi2 commented Nov 6, 2023

I am not sure you can override GITHUB_SHA to some custom value. We should better fix sbt-dependency-submission to read the value from a different env var.

@MPV
Copy link
Contributor Author

MPV commented Nov 6, 2023

If I understand correctly we should use github.event.pull_request.head.sha, when it is available, instead of GITHUB_SHA. @MPV would you like to contribute?

I don't have any idea how to change this repo to get it to work. Ideas?

@johnpangalos
Copy link
Contributor

I made a PR for seeing if the event is a pull request and then using the correct sha. See if that works for you @MPV.

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 a pull request may close this issue.

3 participants