changeset-reporter #4
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: 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@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Download results | |
uses: dawidd6/action-download-artifact@bd10f381a96414ce2b13a11bfa89902ba7cea07f # ratchet:dawidd6/[email protected] | |
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 | |
# release notes: https://github.com/marocchino/sticky-pull-request-comment/releases/tag/v2.9.0 | |
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # ratchet:marocchino/[email protected] | |
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 | |
# release notes: https://github.com/marocchino/sticky-pull-request-comment/releases/tag/v2.9.0 | |
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # ratchet:marocchino/[email protected] | |
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 | |
# release notes: https://github.com/marocchino/sticky-pull-request-comment/releases/tag/v2.9.0 | |
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # ratchet:marocchino/[email protected] | |
with: | |
header: changeset | |
number: ${{ fromJson(steps.changeset.outputs.CHANGESET).pr }} | |
delete: true |