Skip to content

Commit

Permalink
Create diff_comment.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
uniqueg authored Oct 29, 2024
1 parent 6e221f4 commit 8cd84fd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/diff_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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.outputs.diff_generated == 'openapi-diff-log'
permissions:
issues: write
steps:
- name: Download diff
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
})

0 comments on commit 8cd84fd

Please sign in to comment.