Rename to loadMigratableRuntime, cleanup, comment fixup #2
Workflow file for this run
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: "pr-check-changeset" | |
# This workflow checks PRs for the presence of a new changeset file. When a PR is opened, it will be checked for a | |
# changeset. The results of the check are uploaded as a pipeline artifact. After this workflow is completed it triggers | |
# the changeset-reporter workflow, which adds a comment to the PR depending on the results of the check. | |
# | |
# The workflows are separated for security reasons. This workflow does not require write access to the repo, but the | |
# changeset-reporter workflow does. | |
on: | |
pull_request: | |
types: [labeled, unlabeled, opened, synchronize, reopened] | |
permissions: | |
pull-requests: read | |
jobs: | |
# When a PR has the changeset-required label, check if it has a changeset. | |
changeset-required: | |
name: Changeset required | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'changeset-required') | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3 | |
with: | |
fetch-depth: "0" # all history | |
persist-credentials: false | |
ref: ${{ github.event.pull_request.head.sha }} # Check out the head commit, not the merge commit | |
# install and configure node, pnpm and the changeset tools | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # ratchet:pnpm/action-setup@v4 | |
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # ratchet:actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: "pnpm" | |
cache-dependency-path: pnpm-lock.yaml | |
- name: Install tools | |
run: | | |
# We only need to install the root dependencies | |
pnpm install -w --frozen-lockfile | |
# Add the remote in forked repos so we can more easily test in forks | |
- run: git remote add upstream https://github.com/microsoft/FluidFramework | |
if: github.repository_owner != 'microsoft' | |
- run: git fetch upstream | |
if: github.repository_owner != 'microsoft' | |
- run: git log -1 | |
if: github.repository_owner != 'microsoft' | |
# Check whether a changeset was added. This step will have the outcome '1' if there is no changeset. | |
- name: Changeset metadata | |
run: | | |
# JSON output is piped through jq to compact it to a single line | |
pnpm exec flub check changeset --branch=${{ github.base_ref }} --json | jq -c > changeset-metadata.json | |
# We save the PR number because downstream pipelines are triggered by workflow_run, and the PR number is not easily | |
# retrievable in such workflows | |
- name: Add PR number to metadata | |
run: | | |
echo $(jq -c '. += { pr: "${{ github.event.number }}" }' changeset-metadata.json) > changeset-metadata.json | |
# Sets required = true/false based on the changeset-required label on the PR | |
- name: Changeset required | |
if: contains(github.event.pull_request.labels.*.name, 'changeset-required') | |
run: | | |
echo $(jq -c '. += {required: true}' changeset-metadata.json) > changeset-metadata.json | |
- name: Changeset not required | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changeset-required') }} | |
run: | | |
echo $(jq -c '. += {required: false}' changeset-metadata.json) > changeset-metadata.json | |
- name: Upload changeset metadata | |
# release notes: https://github.com/actions/upload-artifact/releases/tag/v4.4.3 | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # ratchet:actions/upload-artifact@v4 | |
with: | |
name: changeset-metadata | |
path: ./changeset-metadata.json | |
retention-days: 3 | |
# Any PR without the changeset-required label will be ignored. | |
changeset-not-required: | |
name: Changeset not required | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changeset-required') }} | |
steps: | |
# Always output changesetFound = true and required = false to signal that changesets aren't needed. changesetFound | |
# must be set because it's not nullable. | |
- name: Changeset metadata | |
run: | | |
echo "{\"branch\": \"${{ github.base_ref }}\", \"required\": false, \"changesetFound\": true}" > ./changeset-metadata.json | |
# We save the PR number because downstream pipelines are triggered by workflow_run, and the PR number is not easily | |
# retrievable in such workflows | |
- name: Add PR number to metadata | |
run: | | |
echo $(jq -c '. += { pr: "${{ github.event.number }}" }' changeset-metadata.json) > changeset-metadata.json | |
- name: Upload changeset metadata | |
# release notes: https://github.com/actions/upload-artifact/releases/tag/v4.4.3 | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # ratchet:actions/upload-artifact@v4 | |
with: | |
name: changeset-metadata | |
path: ./changeset-metadata.json | |
retention-days: 3 |