FluidFramework/.github/workflows/changeset-reporter.yml

64 строки
2.9 KiB
YAML

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/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
# release notes: https://github.com/marocchino/sticky-pull-request-comment/releases/tag/v2.9.0
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # ratchet:marocchino/sticky-pull-request-comment@v2.9.0
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/sticky-pull-request-comment@v2.9.0
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/sticky-pull-request-comment@v2.9.0
with:
header: changeset
number: ${{ fromJson(steps.changeset.outputs.CHANGESET).pr }}
delete: true