-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support JSON output in check:changeset (#15465)
The changeset workflows continue to challenge me. The simple 0/1 output isn't working for reasons I cannot explain, so I have added JSON support to the check:changeset command. When the `--json` flag is passed, the exit code will not be 1 in the case of a missing changeset. Instead the JSON output includes a boolean value that should be checked. I included the workflow changes in this PR so reviewers can see how these command changes will be consumed. They won't be merged with this PR - they'll be made separately (see #15472) after these changes are available in the client release group.
- Loading branch information
1 parent
44bc951
commit cb98c6e
Showing
4 changed files
with
42 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,21 +20,20 @@ jobs: | |
with: | ||
workflow: pr-check-changeset.yml | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: changeset-status | ||
name: changeset-metadata | ||
|
||
- name: Load status | ||
id: status | ||
run: echo "status=$(cat changeset-status)" >> $GITHUB_OUTPUT | ||
- name: Load changeset metadata into env variable | ||
run: echo "CHANGESET=$(cat changeset-metadata.json)" >> $GITHUB_ENV | ||
|
||
- name: Required but missing | ||
if: steps.status.outputs.status != '0' && contains(github.event.pull_request.labels.*.name, 'changeset-required') | ||
if: fromJson(env.CHANGESET).changesetFound == false && contains(github.event.pull_request.labels.*.name, 'changeset-required') | ||
uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # ratchet:marocchino/[email protected] | ||
with: | ||
header: changeset | ||
path: ./.github/workflows/data/changeset-missing.md | ||
|
||
- name: Required and present | ||
if: steps.status.outputs.status == '0' && contains(github.event.pull_request.labels.*.name, 'changeset-required') | ||
if: fromJson(env.CHANGESET).changesetFound == true && contains(github.event.pull_request.labels.*.name, 'changeset-required') | ||
uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # ratchet:marocchino/[email protected] | ||
with: | ||
header: changeset | ||
|
@@ -43,7 +42,7 @@ jobs: | |
This PR requires a changeset and it has one! Good job! | ||
- name: Changeset not required | ||
if: steps.status.outputs.status == '0' && !contains(github.event.pull_request.labels.*.name, 'changeset-required') | ||
if: fromJson(env.CHANGESET).changesetFound == true && !contains(github.event.pull_request.labels.*.name, 'changeset-required') | ||
uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # ratchet:marocchino/[email protected] | ||
with: | ||
header: changeset | ||
|
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
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
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