Internals: Add 'RTLMeter PR results' workflow

Workflows triggered for a PR from a fork can never have write
permissions, so to post a comment on a PR, it must be done from a
separate workflow triggered by 'workflow_run' in the main repository.
This commit is contained in:
Geza Lore 2025-08-31 15:04:38 +01:00
parent 2aa260a03b
commit 7ac610a3cb
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
---
# DESCRIPTION: Github actions config
# This name is key to badges in README.rst, so we use the name build
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
name: RTLMeter PR results
on:
workflow_run:
workflows:
- RTLMeter
types:
- completed
jobs:
publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
permissions:
actions: read
pull-requests: write
steps:
- name: Download report
uses: actions/github-script@v7
with:
name: rtlmeter-pr-results
run-id: ${{ github.event.workflow_run.id }}
github-tokne: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -la
cat report.txt
gh pr --repo ${{ github.repository }} comment ${{ github.event.workflow_run.pull_requests[0].number }} --body-file report.txt