From c8d92433f07351822e0021628011061a8e7ae245 Mon Sep 17 00:00:00 2001 From: Joshua Feingold Date: Thu, 12 Dec 2024 10:49:02 -0600 Subject: [PATCH] @W-17312010@ Converting dev into dev-4 --- .github/workflows/create-github-release.yml | 8 ++-- .github/workflows/create-release-branch.yml | 4 +- .github/workflows/production-heartbeat.yml | 2 +- .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 +- 9 files changed, 62 insertions(+), 62 deletions(-) diff --git a/.github/workflows/create-github-release.yml b/.github/workflows/create-github-release.yml index c42606cd9..f7c428c59 100644 --- a/.github/workflows/create-github-release.yml +++ b/.github/workflows/create-github-release.yml @@ -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/production-heartbeat.yml b/.github/workflows/production-heartbeat.yml index 6390a34dc..adb9fdbf2 100644 --- a/.github/workflows/production-heartbeat.yml +++ b/.github/workflows/production-heartbeat.yml @@ -22,7 +22,7 @@ jobs: # === Setup. We need to get the code, set up nodejs, and create the results directory. === - uses: actions/checkout@v4 with: - ref: 'release' + ref: 'main-4' - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index 0689b8070..fb136c77b 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -15,10 +15,10 @@ jobs: verify-candidate-tag: runs-on: ubuntu-latest steps: - # Check out the main branch, and get its head commit as output for later. + # Check out the main-4 branch, and get its head commit as output for later. - uses: actions/checkout@v4 with: - ref: 'main' + ref: 'main-4' - run: echo "COMMIT_ID=$(git rev-parse HEAD)" >> $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 {