Skip to content

PR Auto Comment

PR Auto Comment #2

Workflow file for this run

name: PR Auto Comment
on:
workflow_dispatch: # Allows you to trigger the workflow manually
jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Read comment message
id: read_message
run: |
MESSAGE=$(cat .github/workflows/comment-message.md)
# Properly escape the message for GitHub Actions
MESSAGE="${MESSAGE//'%'/'%25'}"
MESSAGE="${MESSAGE//$'\n'/'%0A'}"
MESSAGE="${MESSAGE//$'\r'/'%0D'}"
echo "message=$MESSAGE" >> $GITHUB_OUTPUT
- name: Comment on all open PRs
run: |
PRS=$(gh pr list --state open --json number -q '.[].number')
for PR in $PRS; do
gh pr comment $PR --body "${{ steps.read_message.outputs.message }}"
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}