OpenAPI diff comment #6
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 | |
if: github.event.workflow_run.jobs['diff'].steps.upload-log.outputs.artifact_id == needs.diff_artifact.outputs.artifact_id | |
permissions: | |
issues: write | |
steps: | |
- name: Download diff | |
id: diff_artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: openapi-diff-log | |
- name: Create PR comment | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const diff = require('fs').readFileSync('diff.md', 'utf8'); | |
github.rest.issues.createComment({ | |
issue_number: github.event.workflow_run.pull_requests[0].number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '## OpenAPI diff:\n\n' + diff | |
}) |