check-dist-failed #306
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: check-dist-failed | |
on: | |
workflow_run: | |
workflows: [ check-dist ] | |
types: [ completed ] | |
permissions: | |
pull-requests: read | |
jobs: | |
comment: | |
if: | | |
github.event.workflow_run.conclusion == 'failure' && | |
github.event.workflow_run.event == 'pull_request' | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Add comment | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
const { owner, repo } = context.repo; | |
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
owner, | |
repo, | |
commit_sha: context.payload.workflow_run.head_sha, | |
}); | |
if (prs.length > 0) { | |
const pr = prs[0]; | |
await github.rest.issues.createComment({ | |
owner, | |
repo, | |
issue_number: pr.number, | |
body: `Hi @${pr.user.login} :wave:\n\nIt looks like this pull request makes changes which require the contents of \`dist\` to be updated, but these files have not been included with your changes.\n\nPlease run \`build.ps1\` and commit the changes made to the \`dist\` directory to your branch and push them to this pull request.`, | |
}); | |
} |