Skip to content

Commit 5d9a637

Browse files
committed
Restore trigger of quality monitor
1 parent 0eb30f5 commit 5d9a637

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,74 @@
11
name: 'Quality Monitor Comment PR'
22

33
on:
4-
pull_request:
4+
workflow_run:
5+
workflows: ['Quality Monitor', 'Dependency Check']
6+
types: [completed]
57

68
permissions:
7-
contents: read
89
actions: read
10+
contents: read
911
pull-requests: write
1012
checks: write
1113

1214
jobs:
1315
comment:
16+
if: ${{ github.event.workflow_run.event == 'pull_request' }}
1417
runs-on: ubuntu-latest
1518
name: Comment on PR
1619

1720
steps:
21+
- name: Extract PR number and SHA
22+
id: pr
23+
run: |
24+
pr_number='${{ github.event.workflow_run.pull_requests[0].number }}'
25+
echo "number=$pr_number" >> "$GITHUB_OUTPUT"
26+
sha='${{ github.event.workflow_run.head_sha }}'
27+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
1828
- name: Checkout PR
1929
uses: actions/checkout@v6
2030
with:
21-
ref: ${{ github.event.pull_request.head.sha }}
22-
31+
ref: ${{ steps.pr.outputs.sha }}
2332
- name: Install jq and unzip
2433
run: sudo apt-get update && sudo apt-get install -y jq unzip
25-
34+
- name: Prepare environment
35+
env:
36+
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
37+
REPO: ${{ github.repository }}
38+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
run: |
40+
echo "HEAD_SHA=$HEAD_SHA"
41+
echo "REPO=$REPO"
2642
- name: Fetch reports from dependency check and quality monitor workflows
2743
env:
2844
REPO: ${{ github.repository }}
29-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
45+
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
3046
TOKEN: ${{ secrets.GITHUB_TOKEN }}
3147
OTHER_WORKFLOWS: "quality-monitor-build.yml,dependency-check.yml"
3248
ARTIFACT_NAMES: "quality-reports,dependency-report"
33-
ALLOWED_EVENTS: "pull_request,pull_request_target"
34-
RETRIES: 60
49+
RETRIES: 30
3550
SLEEP_SEC: 10
3651
run: |
3752
chmod +x ./.github/scripts/fetch-artifacts.sh
3853
./.github/scripts/fetch-artifacts.sh
39-
4054
- name: List downloaded reports
4155
run: |
4256
mkdir -p reports/target
4357
mv artifacts/*/target/* reports/target
4458
ls -la reports/target/* || true
45-
4659
- name: Read Quality Monitor Configuration
4760
id: quality-monitor
4861
run: echo "json=$(jq -c . .github/quality-monitor-pr.json)" >> "$GITHUB_OUTPUT"
49-
5062
- name: Read Quality Gates Configuration
5163
id: quality-gates
5264
run: echo "json=$(jq -c . .github/quality-gates-pr.json)" >> "$GITHUB_OUTPUT"
53-
5465
- name: Run Quality Monitor and Comment on PR
5566
uses: uhafner/quality-monitor@v4
5667
with:
57-
sha: ${{ github.event.pull_request.head.sha }}
68+
sha: ${{ steps.pr.outputs.sha }}
5869
config: ${{ steps.quality-monitor.outputs.json }}
5970
quality-gates: ${{ steps.quality-gates.outputs.json }}
60-
pr-number: ${{ github.event.pull_request.number }}
71+
pr-number: ${{ steps.pr.outputs.number }}
6172
comments-strategy: REMOVE
6273
show-headers: true
6374
title-metric: none

0 commit comments

Comments
 (0)