Quality Monitor » PR #805
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Quality Monitor Comment PR' | |
| on: | |
| workflow_run: | |
| workflows: ['Quality Monitor', 'Dependency Check'] | |
| types: [completed] | |
| permissions: | |
| actions: read | |
| contents: read | |
| pull-requests: write | |
| checks: write | |
| jobs: | |
| comment: | |
| if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| name: Comment on PR | |
| steps: | |
| - name: Checkout PR | |
| uses: actions/checkout@v6 | |
| - name: Fetch reports from dependency check and quality monitor workflows | |
| env: | |
| REPO: ${{ github.repository }} | |
| HEAD_SHA: ${{ github.event.workflow_run.head_sha }} | |
| TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| OTHER_WORKFLOWS: "quality-monitor-build.yml,dependency-check.yml" | |
| ARTIFACT_NAMES: "quality-reports,dependency-report" | |
| run: | | |
| chmod +x ./.github/scripts/fetch-artifacts.sh | |
| ./.github/scripts/fetch-artifacts.sh | |
| - name: List downloaded reports | |
| run: | | |
| mkdir -p reports/target | |
| mv artifacts/*/target/* reports/target | |
| ls -la reports/target/* || true | |
| mv artifacts/*/pr-number.txt reports/ | |
| - name: Extract PR number and SHA | |
| id: pr | |
| run: | | |
| pr_number="$(cat reports/pr-number.txt | tr -d '\r\n' | xargs)" | |
| if [ -z "$pr_number" ] || [ "$pr_number" = "null" ]; then | |
| echo "No PR associated with this workflow run" >&2 | |
| exit 1 | |
| fi | |
| echo "PR number from reports/pr-number.txt: $pr_number" | |
| echo "number=$pr_number" >> "$GITHUB_OUTPUT" | |
| - name: Install jq and unzip | |
| run: sudo apt-get update && sudo apt-get install -y jq unzip | |
| - name: Prepare environment | |
| env: | |
| HEAD_SHA: ${{ github.event.workflow_run.head_sha }} | |
| REPO: ${{ github.repository }} | |
| TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "HEAD_SHA=$HEAD_SHA" | |
| echo "REPO=$REPO" | |
| - name: Read Quality Monitor Configuration | |
| id: quality-monitor | |
| run: echo "json=$(jq -c . .github/quality-monitor-pr.json)" >> "$GITHUB_OUTPUT" | |
| - name: Read Quality Gates Configuration | |
| id: quality-gates | |
| run: echo "json=$(jq -c . .github/quality-gates-pr.json)" >> "$GITHUB_OUTPUT" | |
| - name: Run Quality Monitor and Comment on PR | |
| uses: uhafner/quality-monitor@v4 | |
| with: | |
| sha: ${{ github.event.workflow_run.head_sha }} | |
| config: ${{ steps.quality-monitor.outputs.json }} | |
| quality-gates: ${{ steps.quality-gates.outputs.json }} | |
| pr-number: ${{ steps.pr.outputs.number }} | |
| comments-strategy: REMOVE | |
| show-headers: true | |
| title-metric: none |