Skip to content

Commit 30086c2

Browse files
committed
add comment to PR
1 parent 0e41a4a commit 30086c2

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/blackduck.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ defaults:
33
run:
44
shell: bash -euo pipefail -c "source nix.source && source .envrc.vars && exec bash {0}"
55
on:
6-
push:
7-
paths:
8-
- go.mod
9-
- go.sum
6+
# Trigger the workflow on pull request events
7+
pull_request:
8+
types: [opened, reopened, synchronized]
9+
# paths:
10+
# - go.mod
11+
# - go.sum
1012

1113
concurrency:
1214
group: ${{ github.workflow }}-${{ github.ref }}
@@ -31,14 +33,22 @@ jobs:
3133
- uses: ./.github/actions/gcloud-login
3234
with:
3335
key: ${{ secrets.DA_IMAGES }}
36+
- name: Comment on the Pull Request
37+
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # Use the comment action
38+
with:
39+
message: |
40+
The NOTICES file has been updated on this PR due to a change in
41+
your library dependencies.
42+
43+
The workflow run ID is **${{ github.run_id }}**.
44+
github-token: ${{ secrets.AUTO_REBASE_PAT }}
3445
- name: Build and Test Go Project
3546
run: |
3647
go build -o target/ ./cmd/...
3748
go test -v ./...
3849
shell: bash -euo pipefail -c "source nix.source && exec bash {0}"
3950
- uses: ./.github/actions/blackduck-scan
4051
- name: Rename notices file
41-
if: github.ref != 'refs/heads/main'
4252
run: |
4353
files=( *Black_Duck_Notices_Report.txt )
4454
if [ "${#files[@]}" -eq 1 ]; then
@@ -49,19 +59,17 @@ jobs:
4959
fi
5060
shell: bash -euo pipefail -c "source nix.source && exec bash {0}"
5161
- name: Add comment to PR
52-
if: github.ref != 'refs/heads/main'
5362
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
5463
with:
5564
script: |
56-
github.rest.issues.createComment({
65+
github.rest.pulls.createComment({
5766
issue_number: context.issue.number,
5867
owner: context.repo.owner,
5968
repo: context.repo.repo,
6069
body: "Auto-generated NOTICES file has been commited back to this PR by GitHub Actions"
6170
})
6271
github-token: '${{ secrets.AUTO_REBASE_PAT }}'
6372
- name: Commit and push changes
64-
if: github.ref != 'refs/heads/main'
6573
run: |
6674
git config user.name "github-actions[bot]"
6775
git config user.email "github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)