Skip to content

Commit

Permalink
@W-17312010@ Converting dev into dev-4
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeingold35 committed Dec 12, 2024
1 parent 8e40d2a commit 950fb46
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 63 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/create-github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ 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.
- closed

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
runs-on: ubuntu-latest
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: |
Expand All @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production-heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand All @@ -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
40 changes: 20 additions & 20 deletions github-actions/verify-pr-title/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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`);
}
Expand All @@ -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`);
Expand Down
18 changes: 9 additions & 9 deletions github-actions/verify-pr-title/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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`);
Expand Down
8 changes: 4 additions & 4 deletions github-actions/verify-pr-title/src/verifyFeaturePrTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions github-actions/verify-pr-title/src/verifyMain2DevPrTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ 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.
*/
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}${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 {
Expand Down
4 changes: 2 additions & 2 deletions github-actions/verify-pr-title/src/verifyReleasePrTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 950fb46

Please sign in to comment.