Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/pr_diff_comment_on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Get PR number'
id: pr-context
env:
# The GH CLI uses this ENV for providing an auth token:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_TARGET_REPO: ${{ github.repository }}
PR_BRANCH: |-
${{
(github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login)
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch)
|| github.event.workflow_run.head_branch
}}
# Query the PR number by repo + branch, then assign to step output:
run: gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" --json 'number' --jq '"number=\(.number)"' >> "${GITHUB_OUTPUT}"
- name: Comment on PR
uses: actions/github-script@v7
with:
Expand All @@ -27,7 +41,7 @@ jobs:
})
let job = jobs.data.jobs[jobs.data.jobs.length - 1]
github.rest.issues.createComment({
issue_number: context.payload.workflow_run.pull_requests[0].number,
issue_number: ${{ steps.pr-context.outputs.number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: `[Diff of generated Data Dictionary XML file](${{ github.server_url }}/${{ github.repository }}/actions/runs/${context.payload.workflow_run.id}/attempts/${context.payload.workflow_run.run_attempt}#summary-${job.id})`
Expand Down