-
Notifications
You must be signed in to change notification settings - Fork 17
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
chore: add workflow for dependency-track #1654
Changes from all commits
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,41 @@ | ||
name: 'This workflow creates bill of material and uploads it to Dependency-Track each night' | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
concurrency: | ||
group: ${{ github.workflow}}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
create-bom: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Install Dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Generate BOMs | ||
run: | | ||
npm install -g @cyclonedx/cdxgen | ||
cdxgen -o sbom.json | ||
- name: Upload SBOM to DependencyTrack | ||
env: | ||
DEPENDENCY_TRACK_API: 'https://dt.security.dhis2.org/api/v1/bom' | ||
run: | | ||
curl -X POST "$DEPENDENCY_TRACK_API" \ | ||
--fail-with-body \ | ||
-H "Content-Type: multipart/form-data" \ | ||
-H "X-Api-Key: ${{ secrets.DEPENDENCYTRACK_APIKEY }}" \ | ||
-F "project=53c6ea2f-413f-45b9-a360-e366f917277d" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we make this project ID a repository variable we can extract this whole workflow and call it from individual repositories - see for example https://github.com/dhis2/route-manager-app/blob/main/.github/workflows/comment-and-close.yml There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree and would love that but please find my considerations above (regarding Yarn version) |
||
-F "bom=@sbom.json" |
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.
(minor) Technically I think this could be just
npx @cyclonedx/cdxgen -o sbom.json
, so you don't need to install anything globally