-
Notifications
You must be signed in to change notification settings - Fork 0
create dependency track workflow #4
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | |||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| name: Dependency Track | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| trivy: | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| container: | |||||||||||||||||||||||||||||
| image: aquasec/trivy:0.67.2 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - run: trivy --version | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| fetch-depth: 0 | |||||||||||||||||||||||||||||
| - run: trivy fs --format cyclonedx --output /tmp/trivy-cyclonedx.json . | |||||||||||||||||||||||||||||
| - run: | | |||||||||||||||||||||||||||||
| IS_LATEST=false | |||||||||||||||||||||||||||||
| if [ "${{ github.ref_name }}" = "${{ github.event.repository.default_branch }}" ]; then | |||||||||||||||||||||||||||||
| IS_LATEST=true | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| curl -X "POST" "https://dependency-track.hawk-dinosaur.ts.net/api/v1/bom" \ | |||||||||||||||||||||||||||||
| -H 'Content-Type: multipart/form-data' \ | |||||||||||||||||||||||||||||
| -H "X-Api-Key: ${{ secrets.DEPENDENCY_TRACK_AUTOMATION_API_KEY }}" \ | |||||||||||||||||||||||||||||
| -F "autoCreate=true" \ | |||||||||||||||||||||||||||||
| -F "projectName=${{ github.repository }}" \ | |||||||||||||||||||||||||||||
| -F "projectVersion=${{ github.ref_name }}" \ | |||||||||||||||||||||||||||||
| -F "isLatest=$IS_LATEST" \ | |||||||||||||||||||||||||||||
| -F "bom=@/tmp/trivy-cyclonedx.json" | |||||||||||||||||||||||||||||
|
Comment on lines
8
to
32
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI about 1 month ago To fix the problem, we should explicitly add a permissions:
contents: readNo imports, methods, or other definitions are necessary.
Suggested changeset
1
.github/workflows/dependency-track.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Positive FeedbackNegative Feedback
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The branch detection logic may not function as intended in a pull request context. In pull requests,
github.ref_nametypically refers to the source branch being merged, not the target branch. To correctly determine if the target branch is the default branch, consider usinggithub.base_refinstead:This ensures the
isLatestflag is properly set when the PR targets the default branch.Spotted by Graphite Agent

Is this helpful? React 👍 or 👎 to let us know.