From efdfa8c358ff1804dcf0ea887471867d4cd16738 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Thu, 11 Aug 2022 17:05:47 -0400 Subject: [PATCH 01/12] Add a workflow to open a PR to the next stage when the stage of an RFC has been updated - Fails if more than one RFC has been updated in a single push - Uses templates in .github/PULL_REQUEST_TEMPLATE for the body of the opened RFCs, with substitution of specific variables - Sets labels on the new PR - Updates the newly opened PR with a commit that adds the the link to the PR to the metadata --- .../advance-to-ready-for-release.md | 50 +++++++ .../advance-to-recommended.md | 61 +++++++++ .../advance-to-released.md | 38 ++++++ .github/workflows/advance-rfc.yml | 127 ++++++++++++++++++ 4 files changed, 276 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/advance-to-released.md create mode 100644 .github/workflows/advance-rfc.yml diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md new file mode 100644 index 0000000000..256e1759b4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md @@ -0,0 +1,50 @@ +# Advance #__RFC_NUMBER__ to the [Ready For Release Stage](https://github.com/emberjs/rfcs#ready-for-release) + +## Summary + +This pull request is advancing the RFC to the [Ready For Release Stage](https://github.com/emberjs/rfcs#ready-for-release). + +- PR to Accepted Stage: #__RFC_NUMBER__ + +**An FCP is required before merging this PR to advance.** + + +
+ Ready for Release Stage Description +This stage is complete when the implementation is complete according to plan +outlined in the RFC, and is in harmony with any changes in Ember that have +occurred since the RFC was first written. This includes any necessary learning +materials. At this stage, features or deprecations may be available for use +behind a feature flag, or with an optional package, etc. + +For codebase changes, there are no open questions that are anticipated to +require breaking changes; the Ember team is ready to commit to the stability of +any interfaces exposed by the current implementation of the feature. + +This stage should include a list of criteria for determining when the proposal can be considered Recommended after being Released. + +An FCP is required to move into this stage. + +Each Ember core team will be requested as a reviewer on the PR to move into this stage. A representative of each team adds a review. If a team does not respond to the request, and after the conclusion of the FCP, it is assumed that the release may proceed. +
+ +## Actions + +- [ ] Implementation is complete according to plan outlined in the RFC +- [ ] Any necessary learning materials have been updated +- [ ] The Ember team is ready to commit to the stability of + any interfaces exposed by the current implementation of the feature +- [ ] Criteria for moving to Recommended Stage has been filled out +- [ ] Each [team](https://github.com/emberjs/rfcs#teams) has reviewed and approved + + +## Criteria for moving to Recommended (required) + +A set of criteria for moving this RFC to the Recommended Stage, following release: + +1. +2. + +## Track Implementation + +<-- Use this section to track implementation of the RFC --> diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md new file mode 100644 index 0000000000..1af2516e94 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md @@ -0,0 +1,61 @@ +# Advance #__RFC_NUMBER__ to the [Recommended Stage](https://github.com/emberjs/rfcs#recommended) + +## Summary + +This pull request is advancing the RFC to the [Recommended Stage](https://github.com/emberjs/rfcs#recommended). + +- PR to Accepted Stage: #__RFC_NUMBER__ +- [PR to Ready For Release Stage](__READY_FOR_RELEASE_PR__) +- [PR to Released Stage](__RELEASED_PR__) + +**An FCP is required before merging this PR to advance.** + + +
+Recommended Stage Summary +The "Recommended" stage is the final milestone for an RFC. It provides a signal +to the wider community to indicate that a feature has been put through its +ecosystem paces and is ready to use. + +To reach the "Recommended" stage, the following should be true: + +If appropriate, the feature is integrated into the tutorial and the guides prose. +API documentation is polished and updates are carried through to other areas of +API docs that may not directly pertain to the feature. + +If the proposal replaces an existing feature, the addon ecosystem has largely +updated to work with both old and new features. + +If the proposal updates or replaces an existing feature, high-quality codemods +are available + +If needed, Ember debugging tools as well as popular IDE support have been +updated to support the feature. + +If the feature is part of a suite of features that were designed to work +together for best ergonomics, the other features are also ready to be +"Recommended". + +Any criteria for "Recommended" for this proposal that were established +in the Ready For Release stage have been met. + +An FCP is required to enter this stage. Multiple RFCs may be moved as a batch +into "Recommended" with the same PR. +
+ +## Actions + +- [ ] Any criteria for "Recommended" for this proposal that were established + in the Ready For Release stage have been met +- [ ] If appropriate, the feature is integrated into the tutorial and the guides prose. + API documentation is polished and updates are carried through to other areas of + API docs that may not directly pertain to the feature. +- [ ] If the proposal replaces an existing feature, the addon ecosystem has largely + updated to work with both old and new features. +- [ ] If the proposal updates or replaces an existing feature, high-quality codemods + are available +- [ ] If needed, Ember debugging tools as well as popular IDE support have been + updated to support the feature. +- [ ] If the feature is part of a suite of features that were designed to work + together for best ergonomics, the other features are also ready to be + "Recommended". diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md new file mode 100644 index 0000000000..a004976eb2 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md @@ -0,0 +1,38 @@ +# Advance #__RFC_NUMBER__ to the [Released Stage](https://github.com/emberjs/rfcs#released) + +## Summary + +This pull request is advancing the RFC to the [Released Stage](https://github.com/emberjs/rfcs#released). + +- PR to Accepted Stage: #__RFC_NUMBER__ +- [PR to Ready For Release Stage](__READY_FOR_RELEASE_PR__) + +
+Released Stage Summary + +The work is published. If it is codebase-related work, it is in a stable version +of the relevant package(s). If there are any critical deviations from the +original RFC, they are briefly noted at the top of the RFC. + +If the work for an RFC is spread across multiple releases of Ember or other +packages, the RFC is considered to be in the Released stage when all features +are available in stable releases and those packages and versions are noted in +the RFC frontmatter. + +Ember's RFC process can be used for process and work plans that are not about +code. Some examples include Roadmap RFCs, changes to the RFC process itself, +and changes to learning resources. When such an RFC is a candidate for Released, +the work should be shipped as described, and the result should presented to the +team with the intent of gathering feedback about whether anything is missing. +If there is agreement that the work is complete, the RFC may be marked "Released" +and a date is provided instead of a version. + +An RFC is moved into "Released" when the above is verified by consensus of the +relevant team(s) via a PR to update the stage. +
+ +## Actions + +- [ ] The work is published in stable versions of the relevant package(s) +- [ ] Deviations from the original RFC are noted at the top of the RFC +- [ ] Release packages and dates are updated in the RFC frontmatter diff --git a/.github/workflows/advance-rfc.yml b/.github/workflows/advance-rfc.yml new file mode 100644 index 0000000000..d76e87435e --- /dev/null +++ b/.github/workflows/advance-rfc.yml @@ -0,0 +1,127 @@ +name: Open PR to advance an RFC to the next stage + +on: + push: + branches: [ main, master ] + paths: + - 'text/*.md' + +jobs: + advance-rfc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Checkout tools repo + uses: actions/checkout@v3 + with: + repository: emberjs/rfcs-tooling + path: rfcs-tooling + ref: 'kg-create-prs' + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + + - uses: actions/setup-node@v2.1.2 + + - run: yarn install + working-directory: rfcs-tooling + + - name: Find added or modified RFCs + id: rfcs + uses: tj-actions/changed-files@v25 + with: + path: 'text' + json: 'true' + + - name: Fail if more than 1 RFC is added or modified + run: | + len=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '. | length'` + echo "RFCs added or modified: ${{ steps.rfcs.outputs.all_changed_files }}" + if [[ $len > 1 ]]; then + echo "::error::More than 1 RFC is added or modified in this PR; unable to automatically open PRs for advancement" + exit 1 + fi + + - name: Find modified or added RFC path + id: modified_rfc + run: | + changed_file=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '.[0]'` + echo "::set-output name=path::$changed_file" + pr_number="${changed_file//[!0-9]/}" + echo "::set-output name=pr_number::$pr_number" + + - name: Determine if stage has changed + id: has_stage_changed + run: | + len=`echo "${{ steps.rfcs.outputs.added_files }}" | jq '. | length'` + if [[ $len == 1 ]]; then + echo "::set-output name=value::true" + else + if `node rfcs-tooling/has-stage-changed.js ${{ github.event.push.base.sha }} ${{ steps.modified_rfc.outputs.path }}`; then + echo "::set-output name=value::true" + else + echo "::set-output name=value::false" + fi + fi + + - name: Update frontmatter + id: stage + if: ${{ steps.has_stage_changed.outputs.value }} == true + run: | + new_stage=`node rfcs-tooling/find-next-stage.js ${{ steps.modified_rfc.outputs.path }}` + echo "::set-output name=value::$new_stage" + node rfcs-tooling/update-rfc-stage.js $new_stage ${{ steps.modified_rfc.outputs.path }} + + - name: Set variables for use in PR + id: pr_variables + if: ${{ steps.has_stage_changed.outputs.value }} == true + run: | + frontmatter=`node rfcs-tooling/rfc-frontmatter.js ${{ steps.modified_rfc.outputs.path }}` + ready_for_release_pr=`echo $frontmatter | jq '.prs."ready-for-release"'` + ready_for_release_pr=${ready_for_release_pr//\"/} + released_pr=`echo $frontmatter | jq '.prs.released'` + released_pr=${released_pr//\"/} + if [[ ${{ steps.stage.outputs.value }} == "ready-for-release" ]]; then + pretty_stage="Ready for Release" + template=`sed -e 's/__RFC_NUMBER__/${{ steps.modified_rfc.outputs.pr_number }}/g' .github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md` + elif [[ ${{ steps.stage.outputs.value }} == "released" ]]; then + pretty_stage="Released" + template=`sed -e 's/__RFC_NUMBER__/${{ steps.modified_rfc.outputs.pr_number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-released.md` + elif [[ ${{ steps.stage.outputs.value }} == "recommended" ]]; then + pretty_stage="Recommended" + template=`sed -e 's/__RFC_NUMBER__/${{ steps.modified_rfc.outputs.pr_number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" -e "s>__RELEASED_PR__>$released_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md` + fi + # Hacks to pass multi-line strings around in GH Workflows + template="${template//'%'/'%25'}" + template="${template//$'\n'/'%0A'}" + template="${template//$'\r'/'%0D'}" + echo "::set-output name=body::$template" + echo "::set-output name=pretty_stage::$pretty_stage" + + - name: Open PR + if: ${{ steps.has_stage_changed.outputs.value }} == true + id: create_pr + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + commit-message: "Advance RFC to Stage ${{ steps.stage.outputs.value }}" + add-paths: 'text' + branch: "advance-rfc-${{ steps.modified_rfc.outputs.pr_number }}" + title: "Advance RFC #${{ steps.modified_rfc.outputs.pr_number}} to Stage ${{ steps.pr_variables.outputs.pretty_stage }}" + body: "${{ steps.pr_variables.outputs.body }}" + labels: "RFC Advancement,S-${{ steps.pr_variables.outputs.pretty_stage}}" + + - name: Add new PR link to RFC frontmatter + if: ${{ steps.has_stage_changed.outputs.value }} == true + run: | + node rfcs-tooling/update-advancement-pr.js ${{ steps.modified_rfc.outputs.path }} ${{ steps.stage.outputs.value}} ${{ steps.create_pr.outputs.pull-request-url }} + + - name: Update PR + if: ${{ steps.has_stage_changed.outputs.value }} == true + run: | + git config --local user.email 'ember-rfcs@example.com' + git config --local user.name 'Ember.js RFCS CI' + git add ${{ steps.modified_rfc.outputs.path }} + git commit -m "Update RFC ${{ steps.modified_rfc.outputs.pr_number }} ${{ steps.stage.outputs.value }} PR URL" + git push origin advance-rfc-${{ steps.modified_rfc.outputs.pr_number }} From 111207a154bc7dd156314608cbea13323e24e0b8 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Thu, 11 Aug 2022 17:29:27 -0400 Subject: [PATCH 02/12] Github renders markdown differently in PRs and comments than in rendered markdown. It renders line breaks that would otherwise be ignored. This removes all linebreaks of convenience from the templates so that they will render according to available width in the PR body --- .../advance-to-ready-for-release.md | 14 ++---- .../advance-to-recommended.md | 48 ++++++------------- .../advance-to-released.md | 26 +++------- 3 files changed, 26 insertions(+), 62 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md index 256e1759b4..b2139ccea5 100644 --- a/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md @@ -11,15 +11,10 @@ This pull request is advancing the RFC to the [Ready For Release Stage](https://
Ready for Release Stage Description -This stage is complete when the implementation is complete according to plan -outlined in the RFC, and is in harmony with any changes in Ember that have -occurred since the RFC was first written. This includes any necessary learning -materials. At this stage, features or deprecations may be available for use -behind a feature flag, or with an optional package, etc. -For codebase changes, there are no open questions that are anticipated to -require breaking changes; the Ember team is ready to commit to the stability of -any interfaces exposed by the current implementation of the feature. +This stage is complete when the implementation is complete according to plan outlined in the RFC, and is in harmony with any changes in Ember that have occurred since the RFC was first written. This includes any necessary learning materials. At this stage, features or deprecations may be available for use behind a feature flag, or with an optional package, etc. + +For codebase changes, there are no open questions that are anticipated to require breaking changes; the Ember team is ready to commit to the stability of any interfaces exposed by the current implementation of the feature. This stage should include a list of criteria for determining when the proposal can be considered Recommended after being Released. @@ -32,8 +27,7 @@ Each Ember core team will be requested as a reviewer on the PR to move into this - [ ] Implementation is complete according to plan outlined in the RFC - [ ] Any necessary learning materials have been updated -- [ ] The Ember team is ready to commit to the stability of - any interfaces exposed by the current implementation of the feature +- [ ] The Ember team is ready to commit to the stability of any interfaces exposed by the current implementation of the feature - [ ] Criteria for moving to Recommended Stage has been filled out - [ ] Each [team](https://github.com/emberjs/rfcs#teams) has reviewed and approved diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md index 1af2516e94..abea8e71f4 100644 --- a/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md @@ -13,49 +13,31 @@ This pull request is advancing the RFC to the [Recommended Stage](https://github
Recommended Stage Summary -The "Recommended" stage is the final milestone for an RFC. It provides a signal -to the wider community to indicate that a feature has been put through its -ecosystem paces and is ready to use. + +The "Recommended" stage is the final milestone for an RFC. It provides a signal to the wider community to indicate that a feature has been put through its ecosystem paces and is ready to use. To reach the "Recommended" stage, the following should be true: -If appropriate, the feature is integrated into the tutorial and the guides prose. -API documentation is polished and updates are carried through to other areas of -API docs that may not directly pertain to the feature. +If appropriate, the feature is integrated into the tutorial and the guides prose. API documentation is polished and updates are carried through to other areas of API docs that may not directly pertain to the feature. -If the proposal replaces an existing feature, the addon ecosystem has largely -updated to work with both old and new features. +If the proposal replaces an existing feature, the addon ecosystem has largely updated to work with both old and new features. -If the proposal updates or replaces an existing feature, high-quality codemods -are available +If the proposal updates or replaces an existing feature, high-quality codemods are available. -If needed, Ember debugging tools as well as popular IDE support have been -updated to support the feature. +If needed, Ember debugging tools as well as popular IDE support have been updated to support the feature. -If the feature is part of a suite of features that were designed to work -together for best ergonomics, the other features are also ready to be -"Recommended". +If the feature is part of a suite of features that were designed to work together for best ergonomics, the other features are also ready to be "Recommended". -Any criteria for "Recommended" for this proposal that were established -in the Ready For Release stage have been met. +Any criteria for "Recommended" for this proposal that were established in the Ready For Release stage have been met. -An FCP is required to enter this stage. Multiple RFCs may be moved as a batch -into "Recommended" with the same PR. +An FCP is required to enter this stage. Multiple RFCs may be moved as a batch into "Recommended" with the same PR.
## Actions -- [ ] Any criteria for "Recommended" for this proposal that were established - in the Ready For Release stage have been met -- [ ] If appropriate, the feature is integrated into the tutorial and the guides prose. - API documentation is polished and updates are carried through to other areas of - API docs that may not directly pertain to the feature. -- [ ] If the proposal replaces an existing feature, the addon ecosystem has largely - updated to work with both old and new features. -- [ ] If the proposal updates or replaces an existing feature, high-quality codemods - are available -- [ ] If needed, Ember debugging tools as well as popular IDE support have been - updated to support the feature. -- [ ] If the feature is part of a suite of features that were designed to work - together for best ergonomics, the other features are also ready to be - "Recommended". +- [ ] Any criteria for "Recommended" for this proposal that were established in the Ready For Release stage have been met +- [ ] If appropriate, the feature is integrated into the tutorial and the guides prose. API documentation is polished and updates are carried through to other areas of API docs that may not directly pertain to the feature. +- [ ] If the proposal replaces an existing feature, the addon ecosystem has largely updated to work with both old and new features. +- [ ] If the proposal updates or replaces an existing feature, high-quality codemods are available +- [ ] If needed, Ember debugging tools as well as popular IDE support have been updated to support the feature. +- [ ] If the feature is part of a suite of features that were designed to work together for best ergonomics, the other features are also ready to be "Recommended". diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md index a004976eb2..638f682b54 100644 --- a/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md @@ -10,25 +10,13 @@ This pull request is advancing the RFC to the [Released Stage](https://github.co
Released Stage Summary -The work is published. If it is codebase-related work, it is in a stable version -of the relevant package(s). If there are any critical deviations from the -original RFC, they are briefly noted at the top of the RFC. - -If the work for an RFC is spread across multiple releases of Ember or other -packages, the RFC is considered to be in the Released stage when all features -are available in stable releases and those packages and versions are noted in -the RFC frontmatter. - -Ember's RFC process can be used for process and work plans that are not about -code. Some examples include Roadmap RFCs, changes to the RFC process itself, -and changes to learning resources. When such an RFC is a candidate for Released, -the work should be shipped as described, and the result should presented to the -team with the intent of gathering feedback about whether anything is missing. -If there is agreement that the work is complete, the RFC may be marked "Released" -and a date is provided instead of a version. - -An RFC is moved into "Released" when the above is verified by consensus of the -relevant team(s) via a PR to update the stage. +The work is published. If it is codebase-related work, it is in a stable version of the relevant package(s). If there are any critical deviations from the original RFC, they are briefly noted at the top of the RFC. + +If the work for an RFC is spread across multiple releases of Ember or other packages, the RFC is considered to be in the Released stage when all features are available in stable releases and those packages and versions are noted in the RFC frontmatter. + +Ember's RFC process can be used for process and work plans that are not about code. Some examples include Roadmap RFCs, changes to the RFC process itself, and changes to learning resources. When such an RFC is a candidate for Released, the work should be shipped as described, and the result should presented to the team with the intent of gathering feedback about whether anything is missing. If there is agreement that the work is complete, the RFC may be marked "Released" and a date is provided instead of a version. + +An RFC is moved into "Released" when the above is verified by consensus of the relevant team(s) via a PR to update the stage.
## Actions From 69373405a6d1a3106f3b34ccaf0093c6dc88d982 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Thu, 11 Aug 2022 21:23:21 -0400 Subject: [PATCH 03/12] Adjust workflow to account for merged RFCs that have advanced to recommended Open advancement PRs as drafts --- .github/workflows/advance-rfc.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/advance-rfc.yml b/.github/workflows/advance-rfc.yml index d76e87435e..73e9d90f34 100644 --- a/.github/workflows/advance-rfc.yml +++ b/.github/workflows/advance-rfc.yml @@ -75,7 +75,7 @@ jobs: - name: Set variables for use in PR id: pr_variables - if: ${{ steps.has_stage_changed.outputs.value }} == true + if: ${{ steps.stage.outputs.value }} run: | frontmatter=`node rfcs-tooling/rfc-frontmatter.js ${{ steps.modified_rfc.outputs.path }}` ready_for_release_pr=`echo $frontmatter | jq '.prs."ready-for-release"'` @@ -100,7 +100,7 @@ jobs: echo "::set-output name=pretty_stage::$pretty_stage" - name: Open PR - if: ${{ steps.has_stage_changed.outputs.value }} == true + if: ${{ steps.stage.outputs.value }} id: create_pr uses: peter-evans/create-pull-request@v4 with: @@ -111,14 +111,15 @@ jobs: title: "Advance RFC #${{ steps.modified_rfc.outputs.pr_number}} to Stage ${{ steps.pr_variables.outputs.pretty_stage }}" body: "${{ steps.pr_variables.outputs.body }}" labels: "RFC Advancement,S-${{ steps.pr_variables.outputs.pretty_stage}}" + draft: true - name: Add new PR link to RFC frontmatter - if: ${{ steps.has_stage_changed.outputs.value }} == true + if: ${{ steps.stage.outputs.value }} run: | node rfcs-tooling/update-advancement-pr.js ${{ steps.modified_rfc.outputs.path }} ${{ steps.stage.outputs.value}} ${{ steps.create_pr.outputs.pull-request-url }} - name: Update PR - if: ${{ steps.has_stage_changed.outputs.value }} == true + if: ${{ steps.stage.outputs.value }} run: | git config --local user.email 'ember-rfcs@example.com' git config --local user.name 'Ember.js RFCS CI' From 33f5423fee5cd652bf4700c7f315df281583a054 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Fri, 12 Aug 2022 17:33:45 -0400 Subject: [PATCH 04/12] Point to released version of rfcs-tooling --- .github/workflows/advance-rfc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/advance-rfc.yml b/.github/workflows/advance-rfc.yml index 73e9d90f34..af49fc5a00 100644 --- a/.github/workflows/advance-rfc.yml +++ b/.github/workflows/advance-rfc.yml @@ -19,7 +19,7 @@ jobs: with: repository: emberjs/rfcs-tooling path: rfcs-tooling - ref: 'kg-create-prs' + ref: 'v1.2.0' token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - uses: actions/setup-node@v2.1.2 From 23e8b95741511688996b08d13beb7a0349c6d68a Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Wed, 24 Aug 2022 22:01:30 -0400 Subject: [PATCH 05/12] Explicitly add Recommended criteria to the Recommended PR template Enumerate teams in Ready for Release template along with github team names for ease of reference when assigning --- .../advance-to-ready-for-release.md | 8 +++++++- .github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md index b2139ccea5..829af48579 100644 --- a/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md @@ -29,7 +29,13 @@ Each Ember core team will be requested as a reviewer on the PR to move into this - [ ] Any necessary learning materials have been updated - [ ] The Ember team is ready to commit to the stability of any interfaces exposed by the current implementation of the feature - [ ] Criteria for moving to Recommended Stage has been filled out -- [ ] Each [team](https://github.com/emberjs/rfcs#teams) has reviewed and approved +- [ ] Each [team](https://github.com/emberjs/rfcs#relevant-teams) has been added as a reviewer to the PR and approved. + * [ ] Framework @emberjs/framework + * [ ] Data @emberjs/ember-data-core + * [ ] CLI @emberjs/cli + * [ ] Learning @emberjs/learning-core + * [ ] Typescript @emberjs/typescript-core + * [ ] Steering @emberjs/steering ## Criteria for moving to Recommended (required) diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md index abea8e71f4..2f9c5354bc 100644 --- a/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md @@ -41,3 +41,12 @@ An FCP is required to enter this stage. Multiple RFCs may be moved as a batch in - [ ] If the proposal updates or replaces an existing feature, high-quality codemods are available - [ ] If needed, Ember debugging tools as well as popular IDE support have been updated to support the feature. - [ ] If the feature is part of a suite of features that were designed to work together for best ergonomics, the other features are also ready to be "Recommended". + +## Criteria for moving to Recommended (required) + +<-- Copy and paste the criteria for "Recommended" from the Ready For Release stage here --> + +A set of criteria for moving this RFC to the Recommended Stage, following release: + +1. +2. From f66ebb16b7ed6d5dbd045da006fd1c398df92d00 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Sun, 28 Aug 2022 21:10:07 -0400 Subject: [PATCH 06/12] Add GH Actions to verify newly opened RFCs, label newly opened RFCs as `S-Proposed` Reconfigure GH actions to use composite actions and as multiple jobs so it is easy to see when they decide not to run based on the scenario --- .../find-added-or-modified-rfcs/action.yml | 49 ++++ .github/actions/setup-rfcs-tooling/action.yml | 18 ++ .github/workflows/advance-rfc.yml | 230 +++++++++--------- .github/workflows/ci.yml | 17 +- .github/workflows/ensure-filename.yml | 40 --- .../workflows/label-opened-new-rfc-prs.yml | 26 ++ .github/workflows/newly-added-rfcs.yml | 105 ++++++++ 7 files changed, 320 insertions(+), 165 deletions(-) create mode 100644 .github/actions/find-added-or-modified-rfcs/action.yml create mode 100644 .github/actions/setup-rfcs-tooling/action.yml delete mode 100644 .github/workflows/ensure-filename.yml create mode 100644 .github/workflows/label-opened-new-rfc-prs.yml create mode 100644 .github/workflows/newly-added-rfcs.yml diff --git a/.github/actions/find-added-or-modified-rfcs/action.yml b/.github/actions/find-added-or-modified-rfcs/action.yml new file mode 100644 index 0000000000..1cb1d4175d --- /dev/null +++ b/.github/actions/find-added-or-modified-rfcs/action.yml @@ -0,0 +1,49 @@ +name: Find added or modified RFCs +description: 'Find added or modified RFC' + +inputs: + base-sha: + description: 'Base SHA' + required: false + sha: + description: 'SHA' + required: false + +outputs: + modified-rfc: + description: "The path of the RFC that was added or modified" + value: ${{ steps.modified-rfc.outputs.path }} + modified-rfcs-count: + description: "The count of how many RFCs were added or modified" + value: ${{ steps.counts.outputs.all_changed }} + added-rfcs-count: + description: "The count of how many RFCs that were added" + value: ${{ steps.counts.outputs.added }} + +runs: + using: "composite" + steps: + - name: Find added or modified RFCs + id: rfcs + uses: tj-actions/changed-files@v25 + with: + path: 'text' + json: 'true' + sha: ${{ inputs.sha }} + base_sha: ${{ inputs.base-sha }} + + - name: Get counts of changed and added RFCs + id: counts + shell: bash + run: | + changed_len=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '. | length'` + echo "::set-output name=all_changed::$changed_len" + added_len=`echo "${{ steps.rfcs.outputs.added_files }}" | jq '. | length'` + echo "::set-output name=added::$added_len" + + - name: Find modified or added RFC info + id: modified-rfc + shell: bash + run: | + changed_file=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '.[0]'` + echo "::set-output name=path::$changed_file" diff --git a/.github/actions/setup-rfcs-tooling/action.yml b/.github/actions/setup-rfcs-tooling/action.yml new file mode 100644 index 0000000000..cd1b7d65b7 --- /dev/null +++ b/.github/actions/setup-rfcs-tooling/action.yml @@ -0,0 +1,18 @@ +name: Setup RFCs Tooling +description: 'Setup RFCs Tooling' + +runs: + using: "composite" + steps: + - name: Checkout tools repo + uses: actions/checkout@v3 + with: + repository: emberjs/rfcs-tooling + path: rfcs-tooling + ref: 'v1.2.0' + + - uses: actions/setup-node@v3 + + - run: yarn install + shell: bash + working-directory: rfcs-tooling diff --git a/.github/workflows/advance-rfc.yml b/.github/workflows/advance-rfc.yml index af49fc5a00..74ebfd7e49 100644 --- a/.github/workflows/advance-rfc.yml +++ b/.github/workflows/advance-rfc.yml @@ -7,122 +7,128 @@ on: - 'text/*.md' jobs: - advance-rfc: + check-rfcs: + name: 'Did push advance the stage of an RFC?' runs-on: ubuntu-latest + outputs: + new-stage: ${{ steps.new-stage.outputs.value }} + rfc-number: ${{ steps.modified-rfc.outputs.rfc-number }} + modified-rfc: ${{ steps.rfcs.outputs.modified-rfc }} + steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Checkout tools repo - uses: actions/checkout@v3 - with: - repository: emberjs/rfcs-tooling - path: rfcs-tooling - ref: 'v1.2.0' - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - - uses: actions/setup-node@v2.1.2 - - - run: yarn install - working-directory: rfcs-tooling - - - name: Find added or modified RFCs - id: rfcs - uses: tj-actions/changed-files@v25 - with: - path: 'text' - json: 'true' - - - name: Fail if more than 1 RFC is added or modified - run: | - len=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '. | length'` - echo "RFCs added or modified: ${{ steps.rfcs.outputs.all_changed_files }}" - if [[ $len > 1 ]]; then + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling + + - name: RFCs Added or Changed + id: rfcs + uses: ./.github/actions/find-added-or-modified-rfcs + with: + base-sha: ${{ github.event.before }} + + - name: Fail if more than 1 RFC is added or modified + if: steps.rfcs.outputs.modified-rfcs-count > 1 + run: | echo "::error::More than 1 RFC is added or modified in this PR; unable to automatically open PRs for advancement" exit 1 - fi - - - name: Find modified or added RFC path - id: modified_rfc - run: | - changed_file=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '.[0]'` - echo "::set-output name=path::$changed_file" - pr_number="${changed_file//[!0-9]/}" - echo "::set-output name=pr_number::$pr_number" - - - name: Determine if stage has changed - id: has_stage_changed - run: | - len=`echo "${{ steps.rfcs.outputs.added_files }}" | jq '. | length'` - if [[ $len == 1 ]]; then - echo "::set-output name=value::true" - else - if `node rfcs-tooling/has-stage-changed.js ${{ github.event.push.base.sha }} ${{ steps.modified_rfc.outputs.path }}`; then + + - name: Find modified RFC Number + id: modified-rfc + run: | + changed_file=${{ steps.rfcs.outputs.modified-rfc }} + rfc_number="${changed_file//[!0-9]/}" + echo "RFC Number: $rfc_number" + echo "::set-output name=rfc-number::$rfc_number" + + - name: Determine if stage has changed + id: has-stage-changed + continue-on-error: true + run: | + if [[ ${{ steps.rfcs.outputs.added-rfcs-count }} == 1 ]]; then + echo "A new RFC was added" echo "::set-output name=value::true" else - echo "::set-output name=value::false" + node rfcs-tooling/has-stage-changed.js ${{ github.event.before }} ${{ steps.rfcs.outputs.modified-rfc }} + if [[ $? == 0 ]]; then + echo "::set-output name=value::true" + else + echo "::set-output name=value::false" + fi + fi + + - name: Find new stage + if: steps.has-stage-changed.outputs.value == 'true' + id: new-stage + run: | + new_stage=`node rfcs-tooling/find-next-stage.js ${{ steps.rfcs.outputs.modified-rfc }}` + echo "New Stage: $new_stage" + echo "::set-output name=value::$new_stage" + + advance-rfc: + name: Open PR to advance RFC to the next stage + runs-on: ubuntu-latest + needs: [ check-rfcs ] + if: needs.check-rfcs.outputs.new-stage + steps: + - uses: actions/checkout@v3 + + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling + + - name: Update frontmatter + run: | + node rfcs-tooling/update-rfc-stage.js ${{ needs.check-rfcs.outputs.new-stage}} ${{ needs.check-rfcs.outputs.modified-rfc }} + + - name: Set variables for use in PR + id: pr-variables + run: | + frontmatter=`node rfcs-tooling/rfc-frontmatter.js ${{ needs.check-rfcs.outputs.modified-rfc }}` + ready_for_release_pr=`echo $frontmatter | jq '.prs."ready-for-release"'` + ready_for_release_pr=${ready_for_release_pr//\"/} + released_pr=`echo $frontmatter | jq '.prs.released'` + released_pr=${released_pr//\"/} + if [[ ${{ needs.check-rfcs.outputs.new-stage }} == "ready-for-release" ]]; then + pretty_stage="Ready for Release" + template=`sed -e 's/__RFC_NUMBER__/${{ needs.check-rfcs.outputs.rfc-number }}/g' .github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md` + elif [[ ${{ needs.check-rfcs.outputs.new-stage }} == "released" ]]; then + pretty_stage="Released" + template=`sed -e 's/__RFC_NUMBER__/${{ needs.check-rfcs.outputs.rfc-number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-released.md` + elif [[ ${{ needs.check-rfcs.outputs.new-stage }} == "recommended" ]]; then + pretty_stage="Recommended" + template=`sed -e 's/__RFC_NUMBER__/${{ needs.check-rfcs.outputs.rfc-number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" -e "s>__RELEASED_PR__>$released_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md` fi - fi - - - name: Update frontmatter - id: stage - if: ${{ steps.has_stage_changed.outputs.value }} == true - run: | - new_stage=`node rfcs-tooling/find-next-stage.js ${{ steps.modified_rfc.outputs.path }}` - echo "::set-output name=value::$new_stage" - node rfcs-tooling/update-rfc-stage.js $new_stage ${{ steps.modified_rfc.outputs.path }} - - - name: Set variables for use in PR - id: pr_variables - if: ${{ steps.stage.outputs.value }} - run: | - frontmatter=`node rfcs-tooling/rfc-frontmatter.js ${{ steps.modified_rfc.outputs.path }}` - ready_for_release_pr=`echo $frontmatter | jq '.prs."ready-for-release"'` - ready_for_release_pr=${ready_for_release_pr//\"/} - released_pr=`echo $frontmatter | jq '.prs.released'` - released_pr=${released_pr//\"/} - if [[ ${{ steps.stage.outputs.value }} == "ready-for-release" ]]; then - pretty_stage="Ready for Release" - template=`sed -e 's/__RFC_NUMBER__/${{ steps.modified_rfc.outputs.pr_number }}/g' .github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md` - elif [[ ${{ steps.stage.outputs.value }} == "released" ]]; then - pretty_stage="Released" - template=`sed -e 's/__RFC_NUMBER__/${{ steps.modified_rfc.outputs.pr_number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-released.md` - elif [[ ${{ steps.stage.outputs.value }} == "recommended" ]]; then - pretty_stage="Recommended" - template=`sed -e 's/__RFC_NUMBER__/${{ steps.modified_rfc.outputs.pr_number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" -e "s>__RELEASED_PR__>$released_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md` - fi - # Hacks to pass multi-line strings around in GH Workflows - template="${template//'%'/'%25'}" - template="${template//$'\n'/'%0A'}" - template="${template//$'\r'/'%0D'}" - echo "::set-output name=body::$template" - echo "::set-output name=pretty_stage::$pretty_stage" - - - name: Open PR - if: ${{ steps.stage.outputs.value }} - id: create_pr - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - commit-message: "Advance RFC to Stage ${{ steps.stage.outputs.value }}" - add-paths: 'text' - branch: "advance-rfc-${{ steps.modified_rfc.outputs.pr_number }}" - title: "Advance RFC #${{ steps.modified_rfc.outputs.pr_number}} to Stage ${{ steps.pr_variables.outputs.pretty_stage }}" - body: "${{ steps.pr_variables.outputs.body }}" - labels: "RFC Advancement,S-${{ steps.pr_variables.outputs.pretty_stage}}" - draft: true - - - name: Add new PR link to RFC frontmatter - if: ${{ steps.stage.outputs.value }} - run: | - node rfcs-tooling/update-advancement-pr.js ${{ steps.modified_rfc.outputs.path }} ${{ steps.stage.outputs.value}} ${{ steps.create_pr.outputs.pull-request-url }} - - - name: Update PR - if: ${{ steps.stage.outputs.value }} - run: | - git config --local user.email 'ember-rfcs@example.com' - git config --local user.name 'Ember.js RFCS CI' - git add ${{ steps.modified_rfc.outputs.path }} - git commit -m "Update RFC ${{ steps.modified_rfc.outputs.pr_number }} ${{ steps.stage.outputs.value }} PR URL" - git push origin advance-rfc-${{ steps.modified_rfc.outputs.pr_number }} + # Hacks to pass multi-line strings around in GH Workflows + template="${template//'%'/'%25'}" + template="${template//$'\n'/'%0A'}" + template="${template//$'\r'/'%0D'}" + echo "::set-output name=body::$template" + echo "Pretty Stage: $pretty_stage" + echo "::set-output name=pretty-stage::$pretty_stage" + + - name: Open PR + id: create-pr + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + commit-message: "Advance RFC to Stage ${{ needs.check-rfcs.outputs.new-stage }}" + add-paths: 'text' + branch: "advance-rfc-${{ needs.check-rfcs.outputs.rfc-number }}" + title: "Advance RFC #${{ needs.check-rfcs.outputs.rfc-number}} to Stage ${{ steps.pr-variables.outputs.pretty-stage }}" + body: "${{ steps.pr-variables.outputs.body }}" + labels: "RFC Advancement,S-${{ steps.pr-variables.outputs.pretty-stage}}" + draft: true + + - name: Add new PR link to RFC frontmatter + run: | + node rfcs-tooling/update-advancement-pr.js ${{ needs.check-rfcs.outputs.modified-rfc }} ${{ needs.check-rfcs.outputs.new-stage}} ${{ steps.create-pr.outputs.pull-request-url }} + + - name: Update PR + run: | + git config --local user.email 'ember-rfcs@example.com' + git config --local user.name 'Ember.js RFCS CI' + git add ${{ needs.check-rfcs.outputs.modified-rfc }} + git commit -m "Update RFC ${{ needs.check-rfcs.outputs.rfc-number }} ${{ needs.check-rfcs.outputs.new-stage }} PR URL" + git push origin advance-rfc-${{ needs.check-rfcs.outputs.rfc-number }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04f23a8f3e..3d282623b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [master] + branches: [master, main] pull_request: {} jobs: @@ -11,17 +11,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Checkout tools repo - uses: actions/checkout@v3 - with: - repository: emberjs/rfcs-tooling - path: rfcs-tooling - ref: 'v1.1.0' - - - uses: actions/setup-node@v3 - - - run: yarn install - working-directory: rfcs-tooling + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling - name: Lint the frontmatter of all RFCs - run: node ./rfcs-tooling/lint-rfc-frontmatter.js text/*.md \ No newline at end of file + run: node ./rfcs-tooling/lint-rfc-frontmatter.js text/*.md diff --git a/.github/workflows/ensure-filename.yml b/.github/workflows/ensure-filename.yml deleted file mode 100644 index d8dce762bd..0000000000 --- a/.github/workflows/ensure-filename.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Ensure Filename of RFCs - -on: - pull_request: - paths: - - 'text/*.md' - -jobs: - check-filename: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Get Changed Files - uses: lots0logs/gh-action-get-changed-files@2.1.4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Filter Added Files to Added RFCs - id: files - run: | - added_files=`jq -r '[.[] | select(startswith("text/"))] | join(" ")' ${HOME}/files_added.json` - echo "::set-output name=added::$added_files" - - - name: Checkout tools repo - uses: actions/checkout@v2 - with: - repository: emberjs/rfcs-tooling - path: rfcs-tooling - - - uses: actions/setup-node@v2.1.2 - - - run: yarn install - working-directory: rfcs-tooling - - - name: Test RFC Filename matches PR Number that adds it - env: - PR_NUMBER: ${{ github.event.pull_request.number }} - run: node check-filename-matches-pr.js $PR_NUMBER ${{ steps.files.outputs.added }} - working-directory: rfcs-tooling diff --git a/.github/workflows/label-opened-new-rfc-prs.yml b/.github/workflows/label-opened-new-rfc-prs.yml new file mode 100644 index 0000000000..ce723898c3 --- /dev/null +++ b/.github/workflows/label-opened-new-rfc-prs.yml @@ -0,0 +1,26 @@ +name: Label newly opened RFC PRs + +on: + pull_request_target: # This workflow has permissions on the repo, do NOT run code from PRs in this workflow. See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ + types: [opened] + paths: + - 'text/*.md' + +jobs: + label-pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + persist-credentials: false + + - name: RFCs Added or Changed + id: rfcs + uses: ./.github/actions/find-added-or-modified-rfcs + + - uses: actions-ecosystem/action-add-labels@v1 + if: steps.rfcs.outputs.added-rfcs-count > 0 + with: + labels: S-Proposed diff --git a/.github/workflows/newly-added-rfcs.yml b/.github/workflows/newly-added-rfcs.yml new file mode 100644 index 0000000000..4781196571 --- /dev/null +++ b/.github/workflows/newly-added-rfcs.yml @@ -0,0 +1,105 @@ +name: Newly Added RFC + +on: + pull_request: + types: [opened, labeled, unlabeled, synchronize, reopened] + paths: + - 'text/*.md' + +concurrency: + group: newly-added-rfc-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + check-rfcs: + name: Does PR add RFCs? + runs-on: ubuntu-latest + outputs: + rfcs-added: ${{ steps.rfcs.outputs.added-rfcs-count > 0 }} + rfcs-changed: ${{ steps.rfcs.outputs.modified-rfcs-count }} + modified-rfc: ${{ steps.rfcs.outputs.modified-rfc }} + steps: + - uses: actions/checkout@v3 + + - name: RFCs Added or Changed + id: rfcs + uses: ./.github/actions/find-added-or-modified-rfcs + + - name: Debug output + run: | + echo "RFC Added count: ${{ steps.rfcs.outputs.added-rfcs-count }}" + echo "RFC Changed count: ${{ steps.rfcs.outputs.modified-rfcs-count }}" + echo "RFC: ${{ steps.rfcs.outputs.modified-rfc }}" + + check-in-exploring: + name: Stage must be 'Exploring' (via label) for new RFC before merging + if: needs.check-rfcs.outputs.rfcs-added == 'true' + runs-on: ubuntu-latest + needs: [check-rfcs] + steps: + - name: Ensure the RFC is in the Exploring Stage before merge is allowed + if: ${{ !contains(github.event.pull_request.labels.*.name, 'S-Exploring') }} + run: | + echo "::error::Newly added RFCs must advance to the Exploring Stage before merging to Accepted is allowed" + exit 1 + + verify-only-in-one-stage: + name: RFC must be in only one stage before merging (labels) + runs-on: ubuntu-latest + needs: [check-rfcs] + if: needs.check-rfcs.outputs.rfcs-added == 'true' + steps: + - name: Ensure the RFC only has one stage + if: contains(github.event.pull_request.labels.*.name, 'S-Exploring') && contains(github.event.pull_request.labels.*.name, 'S-Proposed') + run: | + echo "::error::Newly added RFC must only have one stage label" + exit 1 + + only-one-rfc-added: + name: Only one RFC can be added in a PR + runs-on: ubuntu-latest + needs: [ check-rfcs ] + if: needs.check-rfcs.outputs.rfcs-added == 'true' + steps: + - name: Fail if more than 1 RFC is added or modified + if: ${{ needs.check-rfcs.outputs.rfcs-changed > 1}} + run: | + echo "::error::More than 1 RFC is added in this PR; will be unable to automatically open PRs for advancement" + exit 1 + + frontmatter-stage-is-accepted: + name: Frontmatter stage must be 'accepted' before merging + runs-on: ubuntu-latest + needs: [ check-rfcs ] + if: needs.check-rfcs.outputs.rfcs-added == 'true' + steps: + - uses: actions/checkout@v3 + + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling + + - name: Verify stage of newly added RFC is `accepted` in frontmatter + run: | + frontmatter=`node rfcs-tooling/rfc-frontmatter.js ${{ needs.check-rfcs.outputs.modified-rfc }}` + stage=`echo $frontmatter | jq '.stage'` + if [[ $stage != '"accepted"' ]]; then + echo "::error::Newly added RFCs must have the stage 'accepted' in the frontmatter" + exit 1 + fi + + check-filename: + name: Filename matches RFC number + runs-on: ubuntu-latest + needs: [ check-rfcs ] + if: needs.check-rfcs.outputs.rfcs-added == 'true' + steps: + - uses: actions/checkout@v3 + + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling + + - name: Test RFC Filename matches PR Number that adds it + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run: node check-filename-matches-pr.js $PR_NUMBER ${{ needs.check-rfcs.outputs.modified-rfc }} + working-directory: rfcs-tooling From 9a2de12dade16f861a8e5c8c76de70aafc9aa645 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Mon, 29 Aug 2022 15:41:16 -0400 Subject: [PATCH 07/12] Add job to check the accepted pr is correct --- .github/workflows/newly-added-rfcs.yml | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/newly-added-rfcs.yml b/.github/workflows/newly-added-rfcs.yml index 4781196571..912506296c 100644 --- a/.github/workflows/newly-added-rfcs.yml +++ b/.github/workflows/newly-added-rfcs.yml @@ -40,7 +40,7 @@ jobs: - name: Ensure the RFC is in the Exploring Stage before merge is allowed if: ${{ !contains(github.event.pull_request.labels.*.name, 'S-Exploring') }} run: | - echo "::error::Newly added RFCs must advance to the Exploring Stage before merging to Accepted is allowed" + echo "::error::Newly added RFCs must advance to the Exploring Stage (via label) before merging to Accepted is allowed" exit 1 verify-only-in-one-stage: @@ -103,3 +103,28 @@ jobs: PR_NUMBER: ${{ github.event.pull_request.number }} run: node check-filename-matches-pr.js $PR_NUMBER ${{ needs.check-rfcs.outputs.modified-rfc }} working-directory: rfcs-tooling + + check-accepted-pr-url: + name: Verify Accepted PR URL is correct + runs-on: ubuntu-latest + needs: [ check-rfcs ] + if: needs.check-rfcs.outputs.rfcs-added == 'true' + steps: + - uses: actions/checkout@v3 + + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling + + - name: Verify Accepted PR URL is correct + run: | + frontmatter=`node rfcs-tooling/rfc-frontmatter.js ${{ needs.check-rfcs.outputs.modified-rfc }}` + accepted_pr=`echo $frontmatter | jq '.prs.accepted'` + accepted_pr=${accepted_pr//\"/} + expected_pr="${{ github.event.pull_request.html_url }}" + expected_pr=${expected_pr//\"/} + if [[ $accepted_pr != $expected_pr ]]; then + echo "Accepted PR in frontmatter: $accepted_pr" + echo "Expected PR in frontmatter: $expected_pr" + echo "::error::Accepted PR URL is incorrect, please update the frontmatter prs.accepted to \"${{ github.event.pull_request.html_url }}\"" + exit 1 + fi From 935d56210e78ad073a82dd65563ee03e3f163fe0 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Mon, 29 Aug 2022 17:43:17 -0400 Subject: [PATCH 08/12] Create a workflow that can be triggered manually to open advancement PRs --- .github/workflows/advance-rfc.yml | 69 ++-------------- .github/workflows/open-advancement-pr.yml | 82 +++++++++++++++++++ .../trigger-opening-advancement-pr.yml | 50 +++++++++++ 3 files changed, 139 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/open-advancement-pr.yml create mode 100644 .github/workflows/trigger-opening-advancement-pr.yml diff --git a/.github/workflows/advance-rfc.yml b/.github/workflows/advance-rfc.yml index 74ebfd7e49..5b95056b0d 100644 --- a/.github/workflows/advance-rfc.yml +++ b/.github/workflows/advance-rfc.yml @@ -68,67 +68,12 @@ jobs: echo "::set-output name=value::$new_stage" advance-rfc: - name: Open PR to advance RFC to the next stage - runs-on: ubuntu-latest + uses: ./.github/workflows/open-advancement-pr.yml needs: [ check-rfcs ] if: needs.check-rfcs.outputs.new-stage - steps: - - uses: actions/checkout@v3 - - - name: Setup RFCs tooling - uses: ./.github/actions/setup-rfcs-tooling - - - name: Update frontmatter - run: | - node rfcs-tooling/update-rfc-stage.js ${{ needs.check-rfcs.outputs.new-stage}} ${{ needs.check-rfcs.outputs.modified-rfc }} - - - name: Set variables for use in PR - id: pr-variables - run: | - frontmatter=`node rfcs-tooling/rfc-frontmatter.js ${{ needs.check-rfcs.outputs.modified-rfc }}` - ready_for_release_pr=`echo $frontmatter | jq '.prs."ready-for-release"'` - ready_for_release_pr=${ready_for_release_pr//\"/} - released_pr=`echo $frontmatter | jq '.prs.released'` - released_pr=${released_pr//\"/} - if [[ ${{ needs.check-rfcs.outputs.new-stage }} == "ready-for-release" ]]; then - pretty_stage="Ready for Release" - template=`sed -e 's/__RFC_NUMBER__/${{ needs.check-rfcs.outputs.rfc-number }}/g' .github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md` - elif [[ ${{ needs.check-rfcs.outputs.new-stage }} == "released" ]]; then - pretty_stage="Released" - template=`sed -e 's/__RFC_NUMBER__/${{ needs.check-rfcs.outputs.rfc-number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-released.md` - elif [[ ${{ needs.check-rfcs.outputs.new-stage }} == "recommended" ]]; then - pretty_stage="Recommended" - template=`sed -e 's/__RFC_NUMBER__/${{ needs.check-rfcs.outputs.rfc-number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" -e "s>__RELEASED_PR__>$released_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md` - fi - # Hacks to pass multi-line strings around in GH Workflows - template="${template//'%'/'%25'}" - template="${template//$'\n'/'%0A'}" - template="${template//$'\r'/'%0D'}" - echo "::set-output name=body::$template" - echo "Pretty Stage: $pretty_stage" - echo "::set-output name=pretty-stage::$pretty_stage" - - - name: Open PR - id: create-pr - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - commit-message: "Advance RFC to Stage ${{ needs.check-rfcs.outputs.new-stage }}" - add-paths: 'text' - branch: "advance-rfc-${{ needs.check-rfcs.outputs.rfc-number }}" - title: "Advance RFC #${{ needs.check-rfcs.outputs.rfc-number}} to Stage ${{ steps.pr-variables.outputs.pretty-stage }}" - body: "${{ steps.pr-variables.outputs.body }}" - labels: "RFC Advancement,S-${{ steps.pr-variables.outputs.pretty-stage}}" - draft: true - - - name: Add new PR link to RFC frontmatter - run: | - node rfcs-tooling/update-advancement-pr.js ${{ needs.check-rfcs.outputs.modified-rfc }} ${{ needs.check-rfcs.outputs.new-stage}} ${{ steps.create-pr.outputs.pull-request-url }} - - - name: Update PR - run: | - git config --local user.email 'ember-rfcs@example.com' - git config --local user.name 'Ember.js RFCS CI' - git add ${{ needs.check-rfcs.outputs.modified-rfc }} - git commit -m "Update RFC ${{ needs.check-rfcs.outputs.rfc-number }} ${{ needs.check-rfcs.outputs.new-stage }} PR URL" - git push origin advance-rfc-${{ needs.check-rfcs.outputs.rfc-number }} + with: + rfc-path: ${{ needs.check-rfcs.outputs.modified-rfc }} + rfc-number: ${{ needs.check-rfcs.outputs.rfc-number }} + new-stage: ${{ needs.check-rfcs.outputs.new-stage }} + secrets: + personal-access-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/open-advancement-pr.yml b/.github/workflows/open-advancement-pr.yml new file mode 100644 index 0000000000..4a0d3a6eaa --- /dev/null +++ b/.github/workflows/open-advancement-pr.yml @@ -0,0 +1,82 @@ +name: Reusable workflow to open advancement PRs + +on: + workflow_call: + inputs: + new-stage: + required: true + type: string + rfc-path: + required: true + type: string + rfc-number: + required: true + type: string + secrets: + personal-access-token: + required: true + +jobs: + advance-rfc: + name: Open PR to advance RFC to the next stage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling + + - name: Update frontmatter + run: | + node rfcs-tooling/update-rfc-stage.js ${{ inputs.new-stage }} ${{ inputs.rfc-path }} + + - name: Set variables for use in PR + id: pr-variables + run: | + frontmatter=`node rfcs-tooling/rfc-frontmatter.js ${{ inputs.rfc-path }}` + ready_for_release_pr=`echo $frontmatter | jq '.prs."ready-for-release"'` + ready_for_release_pr=${ready_for_release_pr//\"/} + released_pr=`echo $frontmatter | jq '.prs.released'` + released_pr=${released_pr//\"/} + if [[ ${{ inputs.new-stage }} == "ready-for-release" ]]; then + pretty_stage="Ready for Release" + template=`sed -e 's/__RFC_NUMBER__/${{ inputs.rfc-number }}/g' .github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md` + elif [[ ${{ inputs.new-stage }} == "released" ]]; then + pretty_stage="Released" + template=`sed -e 's/__RFC_NUMBER__/${{ inputs.rfc-number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-released.md` + elif [[ ${{ inputs.new-stage }} == "recommended" ]]; then + pretty_stage="Recommended" + template=`sed -e 's/__RFC_NUMBER__/${{ inputs.rfc-number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" -e "s>__RELEASED_PR__>$released_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md` + fi + # Hacks to pass multi-line strings around in GH Workflows + template="${template//'%'/'%25'}" + template="${template//$'\n'/'%0A'}" + template="${template//$'\r'/'%0D'}" + echo "::set-output name=body::$template" + echo "Pretty Stage: $pretty_stage" + echo "::set-output name=pretty-stage::$pretty_stage" + + - name: Open PR + id: create-pr + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.personal-access-token }} + commit-message: "Advance RFC to Stage ${{ inputs.new-stage }}" + add-paths: 'text' + branch: "advance-rfc-${{ inputs.rfc-number }}" + title: "Advance RFC #${{ inputs.rfc-number}} to Stage ${{ steps.pr-variables.outputs.pretty-stage }}" + body: "${{ steps.pr-variables.outputs.body }}" + labels: "RFC Advancement,S-${{ steps.pr-variables.outputs.pretty-stage}}" + draft: true + + - name: Add new PR link to RFC frontmatter + run: | + node rfcs-tooling/update-advancement-pr.js ${{ inputs.rfc-path }} ${{ inputs.new-stage}} ${{ steps.create-pr.outputs.pull-request-url }} + + - name: Update PR + run: | + git config --local user.email 'ember-rfcs@example.com' + git config --local user.name 'Ember.js RFCS CI' + git add ${{ inputs.rfc-path }} + git commit -m "Update RFC ${{ inputs.rfc-number }} ${{ inputs.new-stage }} PR URL" + git push origin advance-rfc-${{ inputs.rfc-number }} diff --git a/.github/workflows/trigger-opening-advancement-pr.yml b/.github/workflows/trigger-opening-advancement-pr.yml new file mode 100644 index 0000000000..6932a7994d --- /dev/null +++ b/.github/workflows/trigger-opening-advancement-pr.yml @@ -0,0 +1,50 @@ +name: Trigger the opening of a PR to advance an RFC to the next stage + +on: + workflow_dispatch: + inputs: + rfc-path: + type: string + required: true + description: Path to the RFC to open PR for advancement to the next stage + +jobs: + gather-rfc-info: + name: 'Gather RFC info' + runs-on: ubuntu-latest + outputs: + new-stage: ${{ steps.new-stage.outputs.value }} + rfc-number: ${{ steps.modified-rfc.outputs.rfc-number }} + + steps: + - uses: actions/checkout@v3 + + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling + + - name: Find modified RFC Number + id: modified-rfc + run: | + changed_file=${{ inputs.rfc-path }} + rfc_number="${changed_file//[!0-9]/}" + echo "RFC Number: $rfc_number" + echo "::set-output name=rfc-number::$rfc_number" + + - name: Find new stage + id: new-stage + run: | + new_stage=`node rfcs-tooling/find-next-stage.js ${{ inputs.rfc-path }}` + echo "New Stage: $new_stage" + echo "::set-output name=value::$new_stage" + + + advance-rfc: + uses: ./.github/workflows/open-advancement-pr.yml + needs: [ gather-rfc-info ] + if: needs.gather-rfc-info.outputs.new-stage + with: + rfc-path: ${{ inputs.rfc-path }} + rfc-number: ${{ needs.gather-rfc-info.outputs.rfc-number }} + new-stage: ${{ needs.gather-rfc-info.outputs.new-stage }} + secrets: + personal-access-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} From be19c927b5023208b9310d7fdca1b7f38472a891 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Thu, 1 Sep 2022 17:42:53 -0400 Subject: [PATCH 09/12] Bump rfcs-tooling --- .github/actions/setup-rfcs-tooling/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-rfcs-tooling/action.yml b/.github/actions/setup-rfcs-tooling/action.yml index cd1b7d65b7..a9d9cd5766 100644 --- a/.github/actions/setup-rfcs-tooling/action.yml +++ b/.github/actions/setup-rfcs-tooling/action.yml @@ -9,7 +9,7 @@ runs: with: repository: emberjs/rfcs-tooling path: rfcs-tooling - ref: 'v1.2.0' + ref: 'v2.0.0' - uses: actions/setup-node@v3 From a82a64520a1eff161556315494bd7bf5a00821bb Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Fri, 11 Nov 2022 18:29:10 -0500 Subject: [PATCH 10/12] Update versions of actions to address the rotting of these automations - Convert from deprecated set-ouput to Github's env files system - Document the workflows and actions and methods of testing - Add some additional outputs for easier debugging --- .github/README.md | 109 ++++++++++++++++++ .../find-added-or-modified-rfcs/action.yml | 14 ++- .github/actions/setup-rfcs-tooling/action.yml | 2 + .github/workflows/advance-rfc.yml | 16 ++- .github/workflows/newly-added-rfcs.yml | 16 ++- .github/workflows/open-advancement-pr.yml | 13 +-- .../trigger-opening-advancement-pr.yml | 14 +-- 7 files changed, 157 insertions(+), 27 deletions(-) create mode 100644 .github/README.md diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000000..02b3ca0a8e --- /dev/null +++ b/.github/README.md @@ -0,0 +1,109 @@ +# emberjs/rfcs automation + +## Workflows + +### newly-added-rfc.yml + +This workflow runs on pull requests. The jobs gate on the first job which determines +if the pull request adds a new RFC. + +This has various checks to ensure new the RFC has correct metadata, filename, etc. + +This should be tested when updating actions/find-added-or-modified-rfcs or any of +the actions used within that action. See [testing](#testing). + +Test the following: +- [ ] Adding a new RFC. A new pull request should be opened with a new RFC, the + first job should correctly determine that an RFC has been added and the other + jobs should run. +- [ ] Modifying an RFC. A new pull request that modifies an existing RFC, the + first job should correctly determine that an RFC has not been added and the other + jobs should not run. + +### ci.yml + +This workflow runs on all pull requests and pushes to the primary branch. It +lints the frontmatter of all RFCs in the repository. + +### label-opened-new-rfc-prs.yml + +This workflow runs on pull requests. The jobs gate on the first job which determines +whether the pull request adds a new RFC. If it does, it labels the pull request with +'S-Proposed' as it is a newly proposed RFC. + +This should be tested when updating actions/find-added-or-modified-rfcs or any of +the actions used within that action. See [testing](#testing). + +Test the following: +- [ ] Adding a new RFC. A new pull request should be opened with a new RFC, the + first job should correctly determine that an RFC has been added and the other + jobs should run. The label `S-Proposed` should be added. +- [ ] Modifying an RFC. A new pull request that modifies an existing RFC, the + first job should correctly determine that an RFC has not been added and the other + jobs should not run. No label should be added. + +### advance-rfc.yml + +This workflow runs on pushes to the primary branch. The jobs gate on the first job +which determines if the push added an RFC or modified the stage of a previously-merged +RFC. + +Due to constraints in determining RFCs that have been modified, this workflow will +fail if the push modifies more than one RFC. If the push didn't modify the stage +of any of the modified RFCs, this can be completely okay. + +If an RFC stage was modified, this triggers the open-advancement-pr.yml workflow. + +This should be tested when updating actions/find-added-or-modified-rfcs or any of +the actions used within that action. See [testing](#testing). + +Test the following: +- [ ] Adding a new RFC. Merging a pull request that adds an RFC should open a + pull request to advance to the next stage using the correct template. +- [ ] Updating an RFC stage. Merging a pull request that modifies an existing RFC's + stage to something other than the last stage should open a pull request to + advance to the next stage using the correct template. +- [ ] Updating an RFC stage to the last stage. Merging a pull request that modifies + an existing RFC's stage to the final stage should NOT open a pull request. +- [ ] Modifying an RFC in any way that is not updating the stage. Merging a pull + request that does this should NOT open a pull request. + +### trigger-opening-advancement-pr.yml + +This workflow runs on workflow_dispatch and can be triggered from the GitHub UI. +It takes a path to an RFC and will open a PR to advance it to the next stage, if +applicable. + +Test the following: +- [ ] In the UI, on this workflow, trigger with a path of an existing RFC. A pull + request should be opened to advance the RFC to the next stage. +- [ ] In the UI, on this workflow, trigger with a path of an existing RFC at the + final stage. A pull request should NOT be opened. + +### open-advancement-pr.yml + +This workflow is used by the advance-rfc.yml workflow to open a pull request to +advance to the next stage. It is also used by the trigger-opening-advancement-pr.yml +workflow. + +## Actions + +### find-added-or-modified-rfcs + +Gathers info about RFCs that have been added or modified in a pull request or push +(depending on inputs passed). + +### setup-rfcs-tooling + +Reusable action to checkout the rfcs-tooling repo and set it up for use. + +## PULL_REQUEST_TEMPLATE + +Directory of templates for use in opening stage advancement pull requests. + +## Testing +[Testing]: #testing + +Testing is primarily done by copying these actions and workflows to a test +repository and running the workflows +(see [kategengler/playground-ghs](https://github.com/kategengler/playground-ghas)). diff --git a/.github/actions/find-added-or-modified-rfcs/action.yml b/.github/actions/find-added-or-modified-rfcs/action.yml index 1cb1d4175d..df1c02ad8a 100644 --- a/.github/actions/find-added-or-modified-rfcs/action.yml +++ b/.github/actions/find-added-or-modified-rfcs/action.yml @@ -1,6 +1,8 @@ name: Find added or modified RFCs description: 'Find added or modified RFC' +# Any workflow using this action requires using actions/checkout with a fetch-depth: 0 + inputs: base-sha: description: 'Base SHA' @@ -25,7 +27,7 @@ runs: steps: - name: Find added or modified RFCs id: rfcs - uses: tj-actions/changed-files@v25 + uses: tj-actions/changed-files@v31 with: path: 'text' json: 'true' @@ -36,14 +38,14 @@ runs: id: counts shell: bash run: | - changed_len=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '. | length'` - echo "::set-output name=all_changed::$changed_len" + changed_len=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '. | length'` + echo "all_changed=$changed_len" >> $GITHUB_OUTPUT added_len=`echo "${{ steps.rfcs.outputs.added_files }}" | jq '. | length'` - echo "::set-output name=added::$added_len" + echo "added=$added_len" >> $GITHUB_OUTPUT - name: Find modified or added RFC info id: modified-rfc shell: bash - run: | + run: | changed_file=`echo "${{ steps.rfcs.outputs.all_changed_files }}" | jq '.[0]'` - echo "::set-output name=path::$changed_file" + echo "path=$changed_file" >> $GITHUB_OUTPUT diff --git a/.github/actions/setup-rfcs-tooling/action.yml b/.github/actions/setup-rfcs-tooling/action.yml index a9d9cd5766..4d6fe7742b 100644 --- a/.github/actions/setup-rfcs-tooling/action.yml +++ b/.github/actions/setup-rfcs-tooling/action.yml @@ -12,6 +12,8 @@ runs: ref: 'v2.0.0' - uses: actions/setup-node@v3 + with: + node-version: 16 - run: yarn install shell: bash diff --git a/.github/workflows/advance-rfc.yml b/.github/workflows/advance-rfc.yml index 5b95056b0d..c0a26ec85d 100644 --- a/.github/workflows/advance-rfc.yml +++ b/.github/workflows/advance-rfc.yml @@ -32,6 +32,9 @@ jobs: - name: Fail if more than 1 RFC is added or modified if: steps.rfcs.outputs.modified-rfcs-count > 1 run: | + echo "## More than one RFC added or modified" >> $GITHUB_STEP_SUMMARY + echo "This workflow is unable to determine if the stage of any of the added or modified RFCs have changed" >> $GITHUB_STEP_SUMMARY + echo "If this DID NOT modify the stage of any RFC, this failure may be ok" >> $GITHUB_STEP_SUMMARY echo "::error::More than 1 RFC is added or modified in this PR; unable to automatically open PRs for advancement" exit 1 @@ -41,21 +44,24 @@ jobs: changed_file=${{ steps.rfcs.outputs.modified-rfc }} rfc_number="${changed_file//[!0-9]/}" echo "RFC Number: $rfc_number" - echo "::set-output name=rfc-number::$rfc_number" + echo "rfc-number=$rfc_number" >> $GITHUB_OUTPUT - name: Determine if stage has changed id: has-stage-changed continue-on-error: true run: | if [[ ${{ steps.rfcs.outputs.added-rfcs-count }} == 1 ]]; then + echo "## Yes, added a new RFC" >> $GITHUB_STEP_SUMMARY echo "A new RFC was added" - echo "::set-output name=value::true" + echo "value=true" >> $GITHUB_OUTPUT else node rfcs-tooling/has-stage-changed.js ${{ github.event.before }} ${{ steps.rfcs.outputs.modified-rfc }} if [[ $? == 0 ]]; then - echo "::set-output name=value::true" + echo "## Yes, stage has changed" >> $GITHUB_STEP_SUMMARY + echo "value=true" >> $GITHUB_OUTPUT else - echo "::set-output name=value::false" + echo "## No, stage unchanged or at final stage" >> $GITHUB_STEP_SUMMARY + echo "value=false" >> $GITHUB_OUTPUT fi fi @@ -65,7 +71,7 @@ jobs: run: | new_stage=`node rfcs-tooling/find-next-stage.js ${{ steps.rfcs.outputs.modified-rfc }}` echo "New Stage: $new_stage" - echo "::set-output name=value::$new_stage" + echo "value=$new_stage" >> $GITHUB_OUTPUT advance-rfc: uses: ./.github/workflows/open-advancement-pr.yml diff --git a/.github/workflows/newly-added-rfcs.yml b/.github/workflows/newly-added-rfcs.yml index 912506296c..4331efa33d 100644 --- a/.github/workflows/newly-added-rfcs.yml +++ b/.github/workflows/newly-added-rfcs.yml @@ -1,13 +1,18 @@ name: Newly Added RFC +# Runs various checks on pull requests that add new RFCs + on: pull_request: - types: [opened, labeled, unlabeled, synchronize, reopened] + types: [opened, labeled, unlabeled, synchronize, reopened, ready_for_review] paths: - 'text/*.md' concurrency: - group: newly-added-rfc-${{ github.head_ref || github.ref }} + # Events within 5 minutes are not guaranteed to run in order, and so when removing S-Proposed and adding S-Exploring + # we can't guarantee that the run of the workflow will be the one where S-Exploring is added. Adding `github.event_name` + # to the concurrency allows both workflows to complete and the PR to eventually have successful checks. + group: newly-added-rfc-${{ github.head_ref || github.ref }}-${{ github.event_name }} cancel-in-progress: true jobs: @@ -20,6 +25,8 @@ jobs: modified-rfc: ${{ steps.rfcs.outputs.modified-rfc }} steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: RFCs Added or Changed id: rfcs @@ -30,6 +37,11 @@ jobs: echo "RFC Added count: ${{ steps.rfcs.outputs.added-rfcs-count }}" echo "RFC Changed count: ${{ steps.rfcs.outputs.modified-rfcs-count }}" echo "RFC: ${{ steps.rfcs.outputs.modified-rfc }}" + if [[ ${{ steps.rfcs.outputs.added-rfcs-count }} == 1 ]]; then + echo "## RFC Added in this PR!!!" >> $GITHUB_STEP_SUMMARY + elif [[ ${{steps.rfcs.outputs.added-rfcs-count}} == 0 ]]; then + echo "## No RFCs added in this PR" >> $GITHUB_STEP_SUMMARY + fi check-in-exploring: name: Stage must be 'Exploring' (via label) for new RFC before merging diff --git a/.github/workflows/open-advancement-pr.yml b/.github/workflows/open-advancement-pr.yml index 4a0d3a6eaa..a581e3c53f 100644 --- a/.github/workflows/open-advancement-pr.yml +++ b/.github/workflows/open-advancement-pr.yml @@ -48,17 +48,15 @@ jobs: pretty_stage="Recommended" template=`sed -e 's/__RFC_NUMBER__/${{ inputs.rfc-number }}/g' -e "s>__READY_FOR_RELEASE_PR__>$ready_for_release_pr>g" -e "s>__RELEASED_PR__>$released_pr>g" .github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md` fi - # Hacks to pass multi-line strings around in GH Workflows - template="${template//'%'/'%25'}" - template="${template//$'\n'/'%0A'}" - template="${template//$'\r'/'%0D'}" - echo "::set-output name=body::$template" + echo 'body<> $GITHUB_OUTPUT + echo "$template" >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT echo "Pretty Stage: $pretty_stage" - echo "::set-output name=pretty-stage::$pretty_stage" + echo "pretty-stage=$pretty_stage" >> $GITHUB_OUTPUT - name: Open PR id: create-pr - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v4.2.0 with: token: ${{ secrets.personal-access-token }} commit-message: "Advance RFC to Stage ${{ inputs.new-stage }}" @@ -80,3 +78,4 @@ jobs: git add ${{ inputs.rfc-path }} git commit -m "Update RFC ${{ inputs.rfc-number }} ${{ inputs.new-stage }} PR URL" git push origin advance-rfc-${{ inputs.rfc-number }} + echo "## Opened PR ${{ steps.create-pr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/trigger-opening-advancement-pr.yml b/.github/workflows/trigger-opening-advancement-pr.yml index 6932a7994d..60c06b0b7b 100644 --- a/.github/workflows/trigger-opening-advancement-pr.yml +++ b/.github/workflows/trigger-opening-advancement-pr.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest outputs: new-stage: ${{ steps.new-stage.outputs.value }} - rfc-number: ${{ steps.modified-rfc.outputs.rfc-number }} + rfc-number: ${{ steps.rfc.outputs.rfc-number }} steps: - uses: actions/checkout@v3 @@ -22,20 +22,20 @@ jobs: - name: Setup RFCs tooling uses: ./.github/actions/setup-rfcs-tooling - - name: Find modified RFC Number - id: modified-rfc + - name: Find RFC Number + id: rfc run: | - changed_file=${{ inputs.rfc-path }} - rfc_number="${changed_file//[!0-9]/}" + rfc=${{ inputs.rfc-path }} + rfc_number="${rfc//[!0-9]/}" echo "RFC Number: $rfc_number" - echo "::set-output name=rfc-number::$rfc_number" + echo "rfc-number=$rfc_number" >> $GITHUB_OUTPUT - name: Find new stage id: new-stage run: | new_stage=`node rfcs-tooling/find-next-stage.js ${{ inputs.rfc-path }}` echo "New Stage: $new_stage" - echo "::set-output name=value::$new_stage" + echo "value=$new_stage" >> $GITHUB_OUTPUT advance-rfc: From 6e786cfd6c2e7afc86b66e4e100139e97fa39481 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Tue, 15 Nov 2022 16:01:27 -0500 Subject: [PATCH 11/12] Add a workflow to generate a json file of all frontmatter data on pushes to the primary branch. Generate an artifact file of data when new PRs to advance are opened. --- .github/README.md | 9 +++++++ .github/actions/setup-rfcs-tooling/action.yml | 2 +- .../generate-rfc-frontmatter-json.yml | 27 +++++++++++++++++++ .github/workflows/open-advancement-pr.yml | 11 ++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/generate-rfc-frontmatter-json.yml diff --git a/.github/README.md b/.github/README.md index 02b3ca0a8e..1c2a7aafd0 100644 --- a/.github/README.md +++ b/.github/README.md @@ -86,6 +86,15 @@ This workflow is used by the advance-rfc.yml workflow to open a pull request to advance to the next stage. It is also used by the trigger-opening-advancement-pr.yml workflow. +This also generates an artifact named `advancement-prs` with files named `advance-rfc-XYX.json`. +There should be at most one file per RFC. The file contains the latest PR to +advance that RFC, along with other metadata. + +## generate-rfc-frontmatter-json.yml + +This workflow runs on pushes to the primary branch. It generates a JSON file with +all RFC frontmatter and is uploaded to an artifact named `rfc-data`. + ## Actions ### find-added-or-modified-rfcs diff --git a/.github/actions/setup-rfcs-tooling/action.yml b/.github/actions/setup-rfcs-tooling/action.yml index 4d6fe7742b..f44e114eba 100644 --- a/.github/actions/setup-rfcs-tooling/action.yml +++ b/.github/actions/setup-rfcs-tooling/action.yml @@ -9,7 +9,7 @@ runs: with: repository: emberjs/rfcs-tooling path: rfcs-tooling - ref: 'v2.0.0' + ref: 'v2.1.0' - uses: actions/setup-node@v3 with: diff --git a/.github/workflows/generate-rfc-frontmatter-json.yml b/.github/workflows/generate-rfc-frontmatter-json.yml new file mode 100644 index 0000000000..ae0429662b --- /dev/null +++ b/.github/workflows/generate-rfc-frontmatter-json.yml @@ -0,0 +1,27 @@ +name: Generate a JSON file of all frontmatter + +on: + push: + branches: [ main, master ] + paths: + - 'text/*.md' + +jobs: + generate-rfc-frontmatter-data-artifact: + name: 'Generate a JSON file of RFC status' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup RFCs tooling + uses: ./.github/actions/setup-rfcs-tooling + + - name: Generate frontmatter data file + run: | + node rfcs-tooling/list-frontmatter.js text/*.md > rfc-data.json + + - uses: actions/upload-artifact@v3 + with: + name: rfc-data + path: rfc-data.json + if-no-files-found: error diff --git a/.github/workflows/open-advancement-pr.yml b/.github/workflows/open-advancement-pr.yml index a581e3c53f..a4e59a87dc 100644 --- a/.github/workflows/open-advancement-pr.yml +++ b/.github/workflows/open-advancement-pr.yml @@ -79,3 +79,14 @@ jobs: git commit -m "Update RFC ${{ inputs.rfc-number }} ${{ inputs.new-stage }} PR URL" git push origin advance-rfc-${{ inputs.rfc-number }} echo "## Opened PR ${{ steps.create-pr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY + + - name: Add PR to artifact + run: | + echo '{ "file": "${{ inputs.rfc-path }}", "number": "${{ inputs.rfc-number }}", "pr": "${{ steps.create-pr.outputs.pull-request-url }}", "advancementStage": "${{ inputs.new-stage }}" }' > advance-rfc-${{ inputs.rfc-number }}.json + + - name: Upload artifact of open RFC PRs + uses: actions/upload-artifact@v3 + with: + name: advancement-prs + path: advance-rfc-${{ inputs.rfc-number }}.json + if-no-files-found: error From ff3dbd3f88bd73cdde694dc93585ecb0cc4d47e1 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Mon, 21 Nov 2022 17:51:01 -0500 Subject: [PATCH 12/12] Update wording in PR templates to clarify checklist and that PRs to advance will open automatically --- .../advance-to-ready-for-release.md | 10 ++++++---- .../PULL_REQUEST_TEMPLATE/advance-to-recommended.md | 3 ++- .github/PULL_REQUEST_TEMPLATE/advance-to-released.md | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md index 829af48579..659a59100d 100644 --- a/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-ready-for-release.md @@ -8,6 +8,7 @@ This pull request is advancing the RFC to the [Ready For Release Stage](https:// **An FCP is required before merging this PR to advance.** +Upon merging this PR, automation will open a draft PR for this RFC to move to the [Released Stage](https://github.com/emberjs/rfcs#released).
Ready for Release Stage Description @@ -23,13 +24,14 @@ An FCP is required to move into this stage. Each Ember core team will be requested as a reviewer on the PR to move into this stage. A representative of each team adds a review. If a team does not respond to the request, and after the conclusion of the FCP, it is assumed that the release may proceed.
-## Actions +## Checklist to move to Ready for Release -- [ ] Implementation is complete according to plan outlined in the RFC +- [ ] Implementation is complete according to plan outlined in the RFC, with any adjustments noted in the RFC - [ ] Any necessary learning materials have been updated - [ ] The Ember team is ready to commit to the stability of any interfaces exposed by the current implementation of the feature -- [ ] Criteria for moving to Recommended Stage has been filled out -- [ ] Each [team](https://github.com/emberjs/rfcs#relevant-teams) has been added as a reviewer to the PR and approved. +- [ ] Criteria for moving to the Recommended Stage has been filled out +- [ ] This PR has been converted from a draft to a regular PR and the `Final Comment Period` label has been added to start the FCP +- [ ] Each [team](https://github.com/emberjs/rfcs#relevant-teams) has been added as a reviewer to the PR at the start of the FCP * [ ] Framework @emberjs/framework * [ ] Data @emberjs/ember-data-core * [ ] CLI @emberjs/cli diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md index 2f9c5354bc..0c2bb48b9e 100644 --- a/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-recommended.md @@ -33,7 +33,7 @@ Any criteria for "Recommended" for this proposal that were established in the Re An FCP is required to enter this stage. Multiple RFCs may be moved as a batch into "Recommended" with the same PR.
-## Actions +## Checklist to move to Recommended - [ ] Any criteria for "Recommended" for this proposal that were established in the Ready For Release stage have been met - [ ] If appropriate, the feature is integrated into the tutorial and the guides prose. API documentation is polished and updates are carried through to other areas of API docs that may not directly pertain to the feature. @@ -41,6 +41,7 @@ An FCP is required to enter this stage. Multiple RFCs may be moved as a batch in - [ ] If the proposal updates or replaces an existing feature, high-quality codemods are available - [ ] If needed, Ember debugging tools as well as popular IDE support have been updated to support the feature. - [ ] If the feature is part of a suite of features that were designed to work together for best ergonomics, the other features are also ready to be "Recommended". +- [ ] This PR has been converted from a draft to a regular PR and the `Final Comment Period` label has been added to start the FCP ## Criteria for moving to Recommended (required) diff --git a/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md b/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md index 638f682b54..494411a73e 100644 --- a/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md +++ b/.github/PULL_REQUEST_TEMPLATE/advance-to-released.md @@ -7,6 +7,8 @@ This pull request is advancing the RFC to the [Released Stage](https://github.co - PR to Accepted Stage: #__RFC_NUMBER__ - [PR to Ready For Release Stage](__READY_FOR_RELEASE_PR__) +Upon merging this PR, automation will open a draft PR for this RFC to move to the [Recommended Stage](https://github.com/emberjs/rfcs#recommended). +
Released Stage Summary @@ -19,8 +21,8 @@ Ember's RFC process can be used for process and work plans that are not about co An RFC is moved into "Released" when the above is verified by consensus of the relevant team(s) via a PR to update the stage.
-## Actions +## Checklist to move to Released - [ ] The work is published in stable versions of the relevant package(s) -- [ ] Deviations from the original RFC are noted at the top of the RFC +- [ ] Deviations from the original RFC are noted in the RFC - [ ] Release packages and dates are updated in the RFC frontmatter