Skip to content

comment-pr

comment-pr #7156

Workflow file for this run

name: comment-pr
on:
workflow_run:
workflows: ["sv-tests-ci"]
types:
- completed
jobs:
Comment:
permissions:
pull-requests: write
name: Comment
runs-on: [self-hosted, Linux, X64, gcp-custom-runners]
container: ubuntu:jammy-20221130
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Install dependencies
run: |
apt-get update -qq
apt install -y unzip
- uses: actions/download-artifact@v4
with:
name: tests_summary
- name: Unpack artifacts
run: |
unzip tests_summary.zip
cat ./tests_summary.md
- name: Generate and append artifacts link
run: |
SUITE_ID=$(cat ./suite_id)
ARTIFACT_URL="https://github.com/chipsalliance/sv-tests/suites/$SUITE_ID"
MD_URL="[Download an archive containing all the details]($ARTIFACT_URL)"
echo -e "\n\n$MD_URL" >> tests_summary.md
- name: Show summary
run: |
cat tests_summary.md > $GITHUB_STEP_SUMMARY
- name: Prepare comment
id: get-comment-body
run: |
body=$(cat ./tests_summary.md)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Get PR number
id: get-pr-number
run: |
num=$(cat ./issue_num)
echo ::set-output name=num::$num
- name: Post comment
uses: KeisukeYamashita/create-comment@v1
with:
number: ${{ steps.get-pr-number.outputs.num }}
check-only-first-line: "true"
unique: "true"
token: ${{ secrets.GITHUB_TOKEN }}
comment: ${{ steps.get-comment-body.outputs.body }}