From bfd289d35402806c4815f71977b0132c80607cf6 Mon Sep 17 00:00:00 2001 From: Joshua Feingold Date: Thu, 12 Dec 2024 11:15:54 -0600 Subject: [PATCH] @W-17312010@ Converting dev into dev-4 --- .github/workflows/create-github-release.yml | 10 +- .github/workflows/create-release-branch.yml | 4 +- .github/workflows/heartbeat-v4.yml | 138 ++++++++++++++++++ .github/workflows/production-heartbeat.yml | 135 +---------------- .github/workflows/publish-to-npm.yml | 30 ++-- github-actions/verify-pr-title/dist/index.js | 40 ++--- github-actions/verify-pr-title/src/index.ts | 18 +-- .../src/verifyFeaturePrTitle.ts | 8 +- .../src/verifyMain2DevPrTitle.ts | 10 +- .../src/verifyReleasePrTitle.ts | 4 +- 10 files changed, 203 insertions(+), 194 deletions(-) create mode 100644 .github/workflows/heartbeat-v4.yml diff --git a/.github/workflows/create-github-release.yml b/.github/workflows/create-github-release.yml index c42606cd9..c4eb5f079 100644 --- a/.github/workflows/create-github-release.yml +++ b/.github/workflows/create-github-release.yml @@ -2,7 +2,7 @@ name: create-github-release on: pull_request: branches: - - main + - main-4 types: # There's no event type for "merged", so we just run any time a PR is closed, and exit early # if the PR wasn't actually merged. @@ -10,7 +10,7 @@ on: jobs: create-github-release: - # Since the workflow runs any time a PR against main is closed, we need this + # Since the workflow runs any time a PR against main-4 is closed, we need this # `if` to make sure that the workflow only does anything meaningful if the PR # was actually merged. if: github.event.pull_request.merged == true @@ -18,10 +18,10 @@ jobs: permissions: contents: write steps: - - name: Checkout main + - name: Checkout main-4 uses: actions/checkout@v4 with: - ref: main + ref: main-4 - name: Get version property id: get-version-property run: | @@ -33,6 +33,6 @@ jobs: tag_name: v${{ steps.get-version-property.outputs.package_version }} name: v${{ steps.get-version-property.outputs.package_version }} body: See [release notes](https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/release-notes.html) - target_commitish: main + target_commitish: main-4 token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} make_latest: true diff --git a/.github/workflows/create-release-branch.yml b/.github/workflows/create-release-branch.yml index 15e3df2fb..243268950 100644 --- a/.github/workflows/create-release-branch.yml +++ b/.github/workflows/create-release-branch.yml @@ -23,10 +23,10 @@ jobs: outputs: branch-name: ${{ steps.create-branch.outputs.branch_name }} steps: - # Checkout `dev` + # Checkout `dev-4` - uses: actions/checkout@v4 with: - ref: 'dev' + ref: 'dev-4' # We need to set up Node and install our Node dependencies. - uses: actions/setup-node@v4 with: diff --git a/.github/workflows/heartbeat-v4.yml b/.github/workflows/heartbeat-v4.yml new file mode 100644 index 000000000..cc4d6edd4 --- /dev/null +++ b/.github/workflows/heartbeat-v4.yml @@ -0,0 +1,138 @@ +name: heartbeat-v4 +on: + workflow_call: # As per documentation, the colon is necessary even though no config is required. + workflow_dispatch: # As per documentation, the colon is necessary even though no config is required. + +jobs: + production-heartbeat: + strategy: + # By default, if any job in a matrix fails, all other jobs are immediately cancelled. This makes the jobs run to completion instead. + fail-fast: false + matrix: + os: [{vm: ubuntu-latest, exe: .sh}, {vm: windows-2019, exe: .cmd}] + node: ['lts/*'] + runs-on: ${{ matrix.os.vm }} + timeout-minutes: 60 + steps: + # === Setup. We need to get the code, set up nodejs, and create the results directory. === + - uses: actions/checkout@v4 + with: + ref: 'main-4' + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '11' + - run: mkdir smoke-test-results + + # === Set our environment variables, either using default values or the repo's secrets === + - name: Set environment variables + id: env_var_setup + # We'll want to use bash for this, to avoid any cross-platform shenanigans + shell: bash + run: | + # In the following script, the use of the `echo "name=value" >> $GITHUB_ENV` structure is used to set/update + # environment variables. Such updates are visible to all subsequent steps. + # + # If the CLI_VERSION repo secret is set, we want to install that version ofsf-cli, so we set an environment + # variable. Otherwise, we leave the environment variable unset, so it implicitly defaults to `latest`. + # Note: This can be used to intentionally fail the GHA by providing an invalid version number. + if [[ -n "${{ secrets.CLI_VERSION }}" ]]; then + echo "CLI_VERSION=@${{ secrets.CLI_VERSION}}" >> $GITHUB_ENV + fi + # If the SCANNER_VERSION repo secret is set, we want to install that version of sfdx-scanner, so we set an + # environment variable. Otherwise, we leave the environment variable unset, so it implicitly defaults to `latest`. + # Note: This can be used to intentionally fail the GHA by providing an invalid version number. + if [[ -n "${{ secrets.SCANNER_VERSION }}" ]]; then + echo "SCANNER_VERSION=@${{ secrets.SCANNER_VERSION }}" >> $GITHUB_ENV + fi + # If the FAIL_SMOKE_TESTS repo secret is set to ANY value, we should respond by deleting the `test/test-jars` + # folder. The smoke tests expect this folder's contents to exist, so an invocation of `scanner:rule:add` should + # fail, thereby failing the smoke tests as a whole. + # Note: This serves no purpose aside from providing a way to simulate a smoke test failure. + if [[ -n "${{ secrets.FAIL_SMOKE_TESTS }}" ]]; then + rm -rf ./test/test-jars + fi + + + # === Make three attempts to install SF through npm === + - name: Install SF + id: sf_install + # If the first attempt fails, wait a minute and try again. After a second failure, wait 5 minutes then try again. Then give up. + # Set an output parameter, `retry_count`, indicating the number of retry attempts that were made. + run: | + (echo "::set-output name=retry_count::0" && npm install -g @salesforce/cli${{ env.CLI_VERSION }}) || + (echo "::set-output name=retry_count::1" && sleep 60 && npm install -g @salesforce/cli${{ env.CLI_VERSION }}) || + (echo "::set-output name=retry_count::2" && sleep 300 && npm install -g @salesforce/cli${{ env.CLI_VERSION }}) + + # === Make three attempts to install the scanner plugin through sf === + - name: Install Scanner Plugin + id: scanner_install + # If the first attempt fails, wait a minute and try again. After a second failure, wait 5 minutes then try again. Then give up. + # Set an output parameter, `retry_count`, indicating the number of retry attempts that were made. + run: | + (echo "::set-output name=retry_count::0" && sf plugins install @salesforce/sfdx-scanner${{ env.SCANNER_VERSION }}) || + (echo "::set-output name=retry_count::1" && sleep 60 && sf plugins install @salesforce/sfdx-scanner${{ env.SCANNER_VERSION }}) || + (echo "::set-output name=retry_count::2" && sleep 300 && sf plugins install @salesforce/sfdx-scanner${{ env.SCANNER_VERSION }}) + + # === Log the installed plugins for easier debugging === + - name: Log plugins + run: sf plugins + + # === Attempt to execute the smoke tests === + - name: Run smoke tests + id: smoke_tests + run: smoke-tests/smoke-test${{ matrix.os.exe }} sf + + # === Upload the smoke-test-results folder as an artifact === + - name: Upload smoke-test-results folder as artifact + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: smoke-test-results-${{ runner.os }} + path: smoke-test-results + + # === Report any problems === + - name: Report problems + # There are problems if any step failed or was skipped. + # Note that the `join()` call omits null values, so if any steps were skipped, they won't have a corresponding + # value in the string. + if: ${{ failure() || cancelled() }} + shell: bash + env: + # Build the status strings for each step as environment variables to save space later. Null retry_count values + # will be replaced with `n/a` to maintain readability in the alert. + CLI_INSTALL_STATUS: ${{ steps.sf_install.outcome }} after ${{ steps.sf_install.outputs.retry_count || 'n/a' }} retries + SCANNER_INSTALL_STATUS: ${{ steps.scanner_install.outcome }} after ${{ steps.scanner_install.outputs.retry_count || 'n/a' }} retries + SMOKE_TESTS_STATUS: ${{ steps.smoke_tests.outcome }} + # A link to this run, so the PagerDuty assignee can quickly get here. + RUN_LINK: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + # GHA env-vars don't have robust conditional logic, so we'll use this if-else branch to define some bash env-vars. + ALERT_SEV="critical" + ALERT_SUMMARY="Production heartbeat script failed on ${{ runner.os }}" + # Define a helper function to create our POST request's data, to sidestep issues with nested quotations. + generate_post_data() { + # This is known as a HereDoc, and it lets us declare multi-line input ending when the specified limit string, + # in this case EOF, is encountered. + cat <> $GITHUB_ENV` structure is used to set/update - # environment variables. Such updates are visible to all subsequent steps. - # - # If the CLI_VERSION repo secret is set, we want to install that version ofsf-cli, so we set an environment - # variable. Otherwise, we leave the environment variable unset, so it implicitly defaults to `latest`. - # Note: This can be used to intentionally fail the GHA by providing an invalid version number. - if [[ -n "${{ secrets.CLI_VERSION }}" ]]; then - echo "CLI_VERSION=@${{ secrets.CLI_VERSION}}" >> $GITHUB_ENV - fi - # If the SCANNER_VERSION repo secret is set, we want to install that version of sfdx-scanner, so we set an - # environment variable. Otherwise, we leave the environment variable unset, so it implicitly defaults to `latest`. - # Note: This can be used to intentionally fail the GHA by providing an invalid version number. - if [[ -n "${{ secrets.SCANNER_VERSION }}" ]]; then - echo "SCANNER_VERSION=@${{ secrets.SCANNER_VERSION }}" >> $GITHUB_ENV - fi - # If the FAIL_SMOKE_TESTS repo secret is set to ANY value, we should respond by deleting the `test/test-jars` - # folder. The smoke tests expect this folder's contents to exist, so an invocation of `scanner:rule:add` should - # fail, thereby failing the smoke tests as a whole. - # Note: This serves no purpose aside from providing a way to simulate a smoke test failure. - if [[ -n "${{ secrets.FAIL_SMOKE_TESTS }}" ]]; then - rm -rf ./test/test-jars - fi - - - # === Make three attempts to install SF through npm === - - name: Install SF - id: sf_install - # If the first attempt fails, wait a minute and try again. After a second failure, wait 5 minutes then try again. Then give up. - # Set an output parameter, `retry_count`, indicating the number of retry attempts that were made. - run: | - (echo "::set-output name=retry_count::0" && npm install -g @salesforce/cli${{ env.CLI_VERSION }}) || - (echo "::set-output name=retry_count::1" && sleep 60 && npm install -g @salesforce/cli${{ env.CLI_VERSION }}) || - (echo "::set-output name=retry_count::2" && sleep 300 && npm install -g @salesforce/cli${{ env.CLI_VERSION }}) - - # === Make three attempts to install the scanner plugin through sf === - - name: Install Scanner Plugin - id: scanner_install - # If the first attempt fails, wait a minute and try again. After a second failure, wait 5 minutes then try again. Then give up. - # Set an output parameter, `retry_count`, indicating the number of retry attempts that were made. - run: | - (echo "::set-output name=retry_count::0" && sf plugins install @salesforce/sfdx-scanner${{ env.SCANNER_VERSION }}) || - (echo "::set-output name=retry_count::1" && sleep 60 && sf plugins install @salesforce/sfdx-scanner${{ env.SCANNER_VERSION }}) || - (echo "::set-output name=retry_count::2" && sleep 300 && sf plugins install @salesforce/sfdx-scanner${{ env.SCANNER_VERSION }}) - # === Log the installed plugins for easier debugging === - - name: Log plugins - run: sf plugins - - # === Attempt to execute the smoke tests === - - name: Run smoke tests - id: smoke_tests - run: smoke-tests/smoke-test${{ matrix.os.exe }} sf - - # === Upload the smoke-test-results folder as an artifact === - - name: Upload smoke-test-results folder as artifact - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: smoke-test-results-${{ runner.os }} - path: smoke-test-results - - # === Report any problems === - - name: Report problems - # There are problems if any step failed or was skipped. - # Note that the `join()` call omits null values, so if any steps were skipped, they won't have a corresponding - # value in the string. - if: ${{ failure() || cancelled() }} - shell: bash - env: - # Build the status strings for each step as environment variables to save space later. Null retry_count values - # will be replaced with `n/a` to maintain readability in the alert. - CLI_INSTALL_STATUS: ${{ steps.sf_install.outcome }} after ${{ steps.sf_install.outputs.retry_count || 'n/a' }} retries - SCANNER_INSTALL_STATUS: ${{ steps.scanner_install.outcome }} after ${{ steps.scanner_install.outputs.retry_count || 'n/a' }} retries - SMOKE_TESTS_STATUS: ${{ steps.smoke_tests.outcome }} - # A link to this run, so the PagerDuty assignee can quickly get here. - RUN_LINK: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - run: | - # GHA env-vars don't have robust conditional logic, so we'll use this if-else branch to define some bash env-vars. - ALERT_SEV="critical" - ALERT_SUMMARY="Production heartbeat script failed on ${{ runner.os }}" - # Define a helper function to create our POST request's data, to sidestep issues with nested quotations. - generate_post_data() { - # This is known as a HereDoc, and it lets us declare multi-line input ending when the specified limit string, - # in this case EOF, is encountered. - cat <> $GITHUB_OUTPUT id: get-branch-commit # Checkout the tag we want to release, and get its head commit as output for later. @@ -31,9 +31,9 @@ jobs: - name: Fail non-matching commits if: ${{ steps.get-branch-commit.outputs.COMMIT_ID != steps.get-tag-commit.outputs.COMMIT_ID }} run: | - echo "Tag commit must match latest commit in main. Branch is ${{ steps.get-branch-commit.outputs.COMMIT_ID }}. Tag is ${{ steps.get-tag-commit.outputs.COMMIT_ID }}" + echo "Tag commit must match latest commit in main-4. Branch is ${{ steps.get-branch-commit.outputs.COMMIT_ID }}. Tag is ${{ steps.get-tag-commit.outputs.COMMIT_ID }}" exit 1 - # Verify that the `package.json`'s version property is 4.Y.Z, as we want to restrict the `dev` and `release` + # Verify that the `package.json`'s version property is 4.Y.Z, as we want to restrict the `dev-4` and `release` # branches to publishing v4.x. - name: Verify major version run: | @@ -103,7 +103,7 @@ jobs: - run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc npm dist-tag add @salesforce/sfdx-scanner@${{ github.event.release.tag_name || inputs.tag }} latest - # Step 5: Create a Pull Request for merging `main` into `dev` + # Step 5: Create a Pull Request for merging `main-4` into `dev-4` create-main2dev-pull-request: needs: promote-to-latest runs-on: macos-latest @@ -113,31 +113,31 @@ jobs: contents: write pull-requests: write steps: - # Check out `main` + # Check out `main-4` - uses: actions/checkout@v4 with: - ref: 'main' - # Create a new branch based on `main`, so that merge conflicts can be manually resolved if need be. + ref: 'main-4' + # Create a new branch based on `main-4`, so that merge conflicts can be manually resolved if need be. - run: | NEW_VERSION=$(jq -r ".version" package.json) git checkout -b m2d/v$NEW_VERSION git push --set-upstream origin m2d/v$NEW_VERSION - # Create a Pull Request from the new branch into `dev`. + # Create a Pull Request from the new branch into `dev-4`. - run: | NEW_VERSION=$(jq -r ".version" package.json) # For whatever reason, the version of 'echo' on GHAs doesn't process backspace by default. # The non-POSIX-standard -e flag causes it to do that. echo -e "This branch and PR were automatically created following the successful release of v$NEW_VERSION.\n\ - It must be MERGED into dev, NOT SQUASHED OR REBASED. Squashing or rebasing this branch onto dev can cause potentially irreconcilable merge conflicts later.\n\ - As an additional safeguard and reminder, the title of this PR MUST include the word 'merging' in the description portion of the PR title, e.g., 'Main2Dev @W-XXXXXXX@ Merging main to dev after vX.Y.Z'.\n\ - If there are conflicts between dev and this branch, you should do the following locally:\n\ - - $ git checkout dev\n\ + It must be MERGED into dev-4, NOT SQUASHED OR REBASED. Squashing or rebasing this branch onto dev-4 can cause potentially irreconcilable merge conflicts later.\n\ + As an additional safeguard and reminder, the title of this PR MUST include the word 'merging' in the description portion of the PR title, e.g., 'Main2Dev @W-XXXXXXX@ Merging main-4 to dev-4 after vX.Y.Z'.\n\ + If there are conflicts between dev-4 and this branch, you should do the following locally:\n\ + - $ git checkout dev-4\n\ - $ git pull\n\ - $ git fetch --all\n\ - $ git checkout m2d/v$NEW_VERSION\n\ - - $ git pull origin dev --no-rebase # You MUST include this flag, or someone's day will be ruined.\n\ + - $ git pull origin dev-4 --no-rebase # You MUST include this flag, or someone's day will be ruined.\n\ - Resolve the merge conflicts manually. When in doubt, ask the code's author for help.\n\ - $ git commit\n\ - $ git push" > body.txt # Create the pull request. - gh pr create -B dev -H m2d/v$NEW_VERSION --title "Filler title. Read description and rename." -F body.txt + gh pr create -B dev-4 -H m2d/v$NEW_VERSION --title "Filler title. Read description and rename." -F body.txt diff --git a/github-actions/verify-pr-title/dist/index.js b/github-actions/verify-pr-title/dist/index.js index af64670bc..274475321 100644 --- a/github-actions/verify-pr-title/dist/index.js +++ b/github-actions/verify-pr-title/dist/index.js @@ -45,14 +45,14 @@ const PR_TYPE_PORTION = "(NEW|FIX|CHANGE)"; const SCOPE_PORTION = "\\([^()]+\\)"; /** * This RegExp matches the title format for Feature Branch pull requests, - * i.e., a PR aimed at {@code dev} or a {@code release-x.y.z} branch, not - * coming from {@code main}. + * i.e., a PR aimed at {@code dev-4} or a {@code release-x.y.z} branch, not + * coming from {@code main-4}. */ const FEATURE_PR_REGEX = new RegExp(`^${PR_TYPE_PORTION}${common_1.SEPARATOR}${SCOPE_PORTION}${common_1.SEPARATOR}${common_1.WORK_ITEM_PORTION}${common_1.SEPARATOR}[^\\s]+.*`, "i"); /** * Verifies that the provided string is an acceptable title for a PR - * aimed at {@code dev} or a {@code release-x.y.z} branch, not coming - * from {@code main}. + * aimed at {@code dev-4} or a {@code release-x.y.z} branch, not coming + * from {@code main-4}. * @param title */ function verifyFeaturePrTitle(title) { @@ -73,27 +73,27 @@ exports.verifyMain2DevPrTitle = void 0; const common_1 = __nccwpck_require__(6979); /** * This regex portion matches the accepted Type options for a pull request - * merging {@code main} (or an {@code m2d/*} branch) back into {@dev}. + * merging {@code main-4} (or an {@code m2d/*} branch) back into {@dev-4}. * NOTE: The only acceptable option for this is {@code MAIN2DEV}, with flexible * casing. */ const PR_TYPE_PORTION = "MAIN2DEV"; /** * This regex portion matches the accepted Descriptor portion of a pull request - * title merging {@code main} (or an {@code m2d/*} branch) back into {@dev}. + * title merging {@code main-4} (or an {@code m2d/*} branch) back into {@dev-4}. * It can contain anything, but its contents must include the words "merging" (as a * reminder that the PR must be merged with a merge commit as opposed to a squash or rebase), * and "vX.Y.Z", which should correspond to the new release. */ const DESCRIPTOR_PORTION = ".*merging.+\\d+\\.\\d+\\.\\d+.*"; /** - * This RegExp matches the title format for pull requests merging {@code main} (or - * an {@code m2d/*} branch) back into {@code dev}. + * This RegExp matches the title format for pull requests merging {@code main-4} (or + * an {@code m2d/*} branch) back into {@code dev-4}. */ const MAIN2DEV_PR_REGEX = new RegExp(`^${PR_TYPE_PORTION}${common_1.SEPARATOR}${common_1.WORK_ITEM_PORTION}${common_1.SEPARATOR}${DESCRIPTOR_PORTION}`, "i"); /** * Verifies that the provided string is an acceptable title for a PR - * merging {@code main} (or an {@code m2d/*} branch) back into {@code dev}. + * merging {@code main-4} (or an {@code m2d/*} branch) back into {@code dev-4}. * @param title */ function verifyMain2DevPrTitle(title) { @@ -119,12 +119,12 @@ const common_1 = __nccwpck_require__(6979); const PR_TYPE_PORTION = "RELEASE"; /** * This RegExp matches the title format for Release Branch pull requests, - * i.e., a PR aimed at the {@code release} or {@code main} branches. + * i.e., a PR aimed at the {@code release} or {@code main-4} branches. */ const RELEASE_PR_REGEX = new RegExp(`^${PR_TYPE_PORTION}${common_1.SEPARATOR}${common_1.WORK_ITEM_PORTION}${common_1.SEPARATOR}[^\\s]+.*`, "i"); /** * Verifies that the provided string is an acceptable title for a PR - * aimed at the {@code release} or {@code main} branches. + * aimed at the {@code release} or {@code main-4} branches. * @param title */ function verifyReleasePrTitle(title) { @@ -31239,20 +31239,20 @@ function run() { const baseBranch = base.ref; const head = pullRequest.head; const headBranch = head.ref; - if (headBranch.startsWith("m2d/") && baseBranch === "dev") { - // "m2d/" is the prefix of the auto-generated branches we use to merge `main` into `dev` post-release. - // Pull Requests merging these branches into `dev` have their own title convention separate from - // the convention for other aimed-at-`dev` PRs. + if (headBranch.startsWith("m2d/") && baseBranch === "dev-4") { + // "m2d/" is the prefix of the auto-generated branches we use to merge `main-4` into `dev-4` post-release. + // Pull Requests merging these branches into `dev-4` have their own title convention separate from + // the convention for other aimed-at-`dev-4` PRs. if ((0, verifyMain2DevPrTitle_1.verifyMain2DevPrTitle)(title)) { - console.log(`PR title '${title}' accepted for dev branch.`); + console.log(`PR title '${title}' accepted for dev-4 branch.`); } else { core.setFailed(`PR title '${title}' does not match the template of "Main2Dev @W-XXXX@ Merging after vX.Y.Z"`); return; } } - else if (baseBranch === "release" || baseBranch === "main") { - // There's a title convention for merging PRs into `release`/`main`. + else if (baseBranch === "release" || baseBranch === "main-4") { + // There's a title convention for merging PRs into `release`/`main-4`. if ((0, verifyReleasePrTitle_1.verifyReleasePrTitle)(title)) { console.log(`PR title '${title}' accepted for ${baseBranch} branch`); } @@ -31261,8 +31261,8 @@ function run() { return; } } - else if (baseBranch == "dev" || /^release-\d+\.\d+\.\d+$/.test(baseBranch)) { - // There's a title convention for merging feature branch PRs into `dev` or `release-X.Y.Z` + else if (baseBranch == "dev-4" || /^release-\d+\.\d+\.\d+$/.test(baseBranch)) { + // There's a title convention for merging feature branch PRs into `dev-4` or `release-X.Y.Z` // branches. if ((0, verifyFeaturePrTitle_1.verifyFeaturePrTitle)(title)) { console.log(`PR title '${title}' accepted for ${baseBranch} branch`); diff --git a/github-actions/verify-pr-title/src/index.ts b/github-actions/verify-pr-title/src/index.ts index c2fbabc73..f01021231 100644 --- a/github-actions/verify-pr-title/src/index.ts +++ b/github-actions/verify-pr-title/src/index.ts @@ -24,20 +24,20 @@ function run(): void { const baseBranch = base.ref; const head = pullRequest.head as {ref: string}; const headBranch = head.ref; - if (headBranch.startsWith("m2d/") && baseBranch === "dev") { - // "m2d/" is the prefix of the auto-generated branches we use to merge `main` into `dev` post-release. - // Pull Requests merging these branches into `dev` have their own title convention separate from - // the convention for other aimed-at-`dev` PRs. + if (headBranch.startsWith("m2d/") && baseBranch === "dev-4") { + // "m2d/" is the prefix of the auto-generated branches we use to merge `main-4` into `dev-4` post-release. + // Pull Requests merging these branches into `dev-4` have their own title convention separate from + // the convention for other aimed-at-`dev-4` PRs. if (verifyMain2DevPrTitle(title)) { - console.log(`PR title '${title}' accepted for dev branch.`); + console.log(`PR title '${title}' accepted for dev-4 branch.`); } else { core.setFailed( `PR title '${title}' does not match the template of "Main2Dev @W-XXXX@ Merging after vX.Y.Z"` ); return; } - } else if (baseBranch === "release" || baseBranch === "main") { - // There's a title convention for merging PRs into `release`/`main`. + } else if (baseBranch === "release" || baseBranch === "main-4") { + // There's a title convention for merging PRs into `release`/`main-4`. if (verifyReleasePrTitle(title)) { console.log(`PR title '${title}' accepted for ${baseBranch} branch`); } else { @@ -46,8 +46,8 @@ function run(): void { ); return; } - } else if (baseBranch == "dev" || /^release-\d+\.\d+\.\d+$/.test(baseBranch)) { - // There's a title convention for merging feature branch PRs into `dev` or `release-X.Y.Z` + } else if (baseBranch == "dev-4" || /^release-\d+\.\d+\.\d+$/.test(baseBranch)) { + // There's a title convention for merging feature branch PRs into `dev-4` or `release-X.Y.Z` // branches. if (verifyFeaturePrTitle(title)) { console.log(`PR title '${title}' accepted for ${baseBranch} branch`); diff --git a/github-actions/verify-pr-title/src/verifyFeaturePrTitle.ts b/github-actions/verify-pr-title/src/verifyFeaturePrTitle.ts index f45cd0532..4e4ae85e5 100644 --- a/github-actions/verify-pr-title/src/verifyFeaturePrTitle.ts +++ b/github-actions/verify-pr-title/src/verifyFeaturePrTitle.ts @@ -14,15 +14,15 @@ const SCOPE_PORTION = "\\([^()]+\\)"; /** * This RegExp matches the title format for Feature Branch pull requests, - * i.e., a PR aimed at {@code dev} or a {@code release-x.y.z} branch, not - * coming from {@code main}. + * i.e., a PR aimed at {@code dev-4} or a {@code release-x.y.z} branch, not + * coming from {@code main-4}. */ const FEATURE_PR_REGEX = new RegExp(`^${PR_TYPE_PORTION}${SEPARATOR}${SCOPE_PORTION}${SEPARATOR}${WORK_ITEM_PORTION}${SEPARATOR}[^\\s]+.*`, "i"); /** * Verifies that the provided string is an acceptable title for a PR - * aimed at {@code dev} or a {@code release-x.y.z} branch, not coming - * from {@code main}. + * aimed at {@code dev-4} or a {@code release-x.y.z} branch, not coming + * from {@code main-4}. * @param title */ export function verifyFeaturePrTitle(title: string): boolean { diff --git a/github-actions/verify-pr-title/src/verifyMain2DevPrTitle.ts b/github-actions/verify-pr-title/src/verifyMain2DevPrTitle.ts index d695b6ee8..4a420688f 100644 --- a/github-actions/verify-pr-title/src/verifyMain2DevPrTitle.ts +++ b/github-actions/verify-pr-title/src/verifyMain2DevPrTitle.ts @@ -2,7 +2,7 @@ import {SEPARATOR, WORK_ITEM_PORTION} from "./common"; /** * This regex portion matches the accepted Type options for a pull request - * merging {@code main} (or an {@code m2d/*} branch) back into {@dev}. + * merging {@code main-4} (or an {@code m2d/*} branch) back into {@dev-4}. * NOTE: The only acceptable option for this is {@code MAIN2DEV}, with flexible * casing. */ @@ -10,7 +10,7 @@ const PR_TYPE_PORTION = "MAIN2DEV"; /** * This regex portion matches the accepted Descriptor portion of a pull request - * title merging {@code main} (or an {@code m2d/*} branch) back into {@dev}. + * title merging {@code main-4} (or an {@code m2d/*} branch) back into {@dev-4}. * It can contain anything, but its contents must include the words "merging" (as a * reminder that the PR must be merged with a merge commit as opposed to a squash or rebase), * and "vX.Y.Z", which should correspond to the new release. @@ -18,14 +18,14 @@ const PR_TYPE_PORTION = "MAIN2DEV"; const DESCRIPTOR_PORTION = ".*merging.+\\d+\\.\\d+\\.\\d+.*"; /** - * This RegExp matches the title format for pull requests merging {@code main} (or - * an {@code m2d/*} branch) back into {@code dev}. + * This RegExp matches the title format for pull requests merging {@code main-4} (or + * an {@code m2d/*} branch) back into {@code dev-4}. */ const MAIN2DEV_PR_REGEX = new RegExp(`^${PR_TYPE_PORTION}${SEPARATOR}${WORK_ITEM_PORTION}${SEPARATOR}${DESCRIPTOR_PORTION}`, "i"); /** * Verifies that the provided string is an acceptable title for a PR - * merging {@code main} (or an {@code m2d/*} branch) back into {@code dev}. + * merging {@code main-4} (or an {@code m2d/*} branch) back into {@code dev-4}. * @param title */ export function verifyMain2DevPrTitle(title: string): boolean { diff --git a/github-actions/verify-pr-title/src/verifyReleasePrTitle.ts b/github-actions/verify-pr-title/src/verifyReleasePrTitle.ts index 2bc6066e5..464d48730 100644 --- a/github-actions/verify-pr-title/src/verifyReleasePrTitle.ts +++ b/github-actions/verify-pr-title/src/verifyReleasePrTitle.ts @@ -8,13 +8,13 @@ const PR_TYPE_PORTION = "RELEASE" /** * This RegExp matches the title format for Release Branch pull requests, - * i.e., a PR aimed at the {@code release} or {@code main} branches. + * i.e., a PR aimed at the {@code release} or {@code main-4} branches. */ const RELEASE_PR_REGEX = new RegExp(`^${PR_TYPE_PORTION}${SEPARATOR}${WORK_ITEM_PORTION}${SEPARATOR}[^\\s]+.*`, "i"); /** * Verifies that the provided string is an acceptable title for a PR - * aimed at the {@code release} or {@code main} branches. + * aimed at the {@code release} or {@code main-4} branches. * @param title */ export function verifyReleasePrTitle(title: string): boolean {