Skip to content

Commit

Permalink
Update diff_comment.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
uniqueg authored Oct 29, 2024
1 parent ed4499b commit 2f6a18a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/diff_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@ on:
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
if: github.event.workflow_run.outputs.diff_generated
permissions:
issues: write
steps:
- name: Get the PR number
id: get_pr_number
run: |
echo "pr_number=$(jq '.workflow_run.pull_requests[0].number' $GITHUB_EVENT_PATH)" >> $GITHUB_OUTPUT
- name: Download diff
id: diff_artifact
uses: actions/download-artifact@v4
with:
name: openapi-diff-log
workflow: 'Lint and validate OpenAPI specs'
- 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,
issue_number: steps.get_pr_number.outputs.pr_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '## OpenAPI diff:\n\n' + diff
Expand Down

0 comments on commit 2f6a18a

Please sign in to comment.