OpenAPI diff comment #21
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: OpenAPI diff comment | |
on: | |
workflow_run: | |
workflows: ["Lint and validate OpenAPI specs"] | |
types: [completed] | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Download diff | |
uses: actions/download-artifact@v4 | |
with: | |
name: diff-artifacts | |
path: diff-artifacts/ | |
run-id: ${{ github.event.workflow_run.id }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create PR comment | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const diff = require('fs').readFileSync('diff-artifacts/diff.md', 'utf8'); | |
const pr_number = require('fs').readFileSync('diff-artifacts/pr_number', 'utf8'); | |
github.rest.issues.createComment({ | |
issue_number: pr_number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '## OpenAPI diff:\n\n' + diff | |
}) |