comment_on_pr #147
This file contains 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: comment_on_pr | |
# read-write repo token | |
# access to secrets | |
on: | |
workflow_run: | |
workflows: ["simmetrx_enabled_pr_comment_trigger_self_hosted"] | |
types: | |
- completed | |
jobs: | |
upload: | |
permissions: | |
actions: read | |
issues: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
if: | | |
github.event.workflow_run.conclusion == 'success' || | |
github.event.workflow_run.conclusion == 'failure' | |
steps: | |
- name: 'Download artifact' | |
uses: actions/download-artifact@v4 | |
with: | |
name: pr | |
run-id: ${{ github.event.workflow_run.id }} | |
github-token: ${{ github.token }} | |
- name: 'Comment on PR' | |
uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
var fs = require('fs'); | |
var issue_number = Number(fs.readFileSync('./issueNumber')); | |
var message = String(fs.readFileSync('./message')); | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue_number, | |
body: message | |
}); |