Skip to content

changeset-reporter #19383

changeset-reporter

changeset-reporter #19383

name: changeset-reporter
# This workflow adds a comment to the PR depending on the results of the pr-check-changeset workflow.
#
# The workflows are separated for security reasons. This workflow requires write access to the repo, but the
# pr-check-changeset workflow does not.
on:
workflow_run:
workflows: [ "pr-check-changeset" ]
types:
- completed
jobs:
load_report:
runs-on: ubuntu-latest
permissions:
actions: read
pull-requests: write
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # ratchet:actions/checkout@v3
with:
persist-credentials: false
- name: Download results
uses: dawidd6/action-download-artifact@bd10f381a96414ce2b13a11bfa89902ba7cea07f # ratchet:dawidd6/action-download-artifact@v2.24.3
with:
workflow: pr-check-changeset.yml
run_id: ${{ github.event.workflow_run.id }}
name: changeset-metadata
- name: Load changeset metadata into output variable
id: changeset
run: echo "CHANGESET=$(cat changeset-metadata.json)" >> $GITHUB_OUTPUT
- name: Required but missing
if: fromJson(steps.changeset.outputs.CHANGESET).required == true && fromJson(steps.changeset.outputs.CHANGESET).changesetFound == false
uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # ratchet:marocchino/sticky-pull-request-comment@v2.3.1
with:
header: changeset
number: ${{ fromJson(steps.changeset.outputs.CHANGESET).pr }}
path: ${{ github.workspace }}/.github/workflows/data/changeset-missing.md
- name: Required and present
if: fromJson(steps.changeset.outputs.CHANGESET).required == true && fromJson(steps.changeset.outputs.CHANGESET).changesetFound == true
uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # ratchet:marocchino/sticky-pull-request-comment@v2.3.1
with:
header: changeset
number: ${{ fromJson(steps.changeset.outputs.CHANGESET).pr }}
recreate: true
message: |
This PR requires a changeset and it has one! Good job!
- name: Changeset not required
if: fromJson(steps.changeset.outputs.CHANGESET).required == false && fromJson(steps.changeset.outputs.CHANGESET).changesetFound == true
uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # ratchet:marocchino/sticky-pull-request-comment@v2.3.1
with:
header: changeset
number: ${{ fromJson(steps.changeset.outputs.CHANGESET).pr }}
delete: true