Skip to content

Add capability-development branch protection CI#327

Merged
amit-momin merged 5 commits intomainfrom
cre/add-capability-development-branch-protection-ci
Mar 26, 2026
Merged

Add capability-development branch protection CI#327
amit-momin merged 5 commits intomainfrom
cre/add-capability-development-branch-protection-ci

Conversation

@amit-momin
Copy link
Contributor

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Mar 25, 2026

⚠️ No Changeset found

Latest commit: d508e43

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link

github-actions bot commented Mar 25, 2026

The latest Buf updates on your PR. Results from workflow Regenerate Protobuf Files / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed⏩ skippedMar 26, 2026, 5:15 PM

@amit-momin amit-momin changed the base branch from main to capabilities-development March 25, 2026 17:03
@amit-momin amit-momin changed the base branch from capabilities-development to main March 25, 2026 17:10
@amit-momin amit-momin force-pushed the cre/add-capability-development-branch-protection-ci branch from 359eb9d to 4396356 Compare March 25, 2026 17:14
@amit-momin amit-momin force-pushed the cre/add-capability-development-branch-protection-ci branch 4 times, most recently from 377d01d to 64301fe Compare March 25, 2026 18:48
@amit-momin amit-momin marked this pull request as ready for review March 25, 2026 18:48
@amit-momin amit-momin requested review from a team as code owners March 25, 2026 18:48
@amit-momin amit-momin changed the title Add capability-development branch protection ci Add capability-development branch protection CI Mar 25, 2026
run: |
git fetch origin "${TARGET_BRANCH}" --quiet 2>/dev/null || true

CRE_CHANGED=$(git diff --name-only "origin/${TARGET_BRANCH}" -- cre/)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CRE_CHANGED=$(git diff --name-only "origin/${TARGET_BRANCH}" -- cre/)
CRE_CHANGED=$(git diff --name-only "origin/${TARGET_BRANCH}...HEAD" -- cre/)

A little more precise

Comment on lines +7 to +13
permissions:
contents: read

jobs:
check-cre-target-branch:
runs-on: ubuntu-latest
steps:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
permissions:
contents: read
jobs:
check-cre-target-branch:
runs-on: ubuntu-latest
steps:
permissions: {}
jobs:
check-cre-target-branch:
permissions:
contents: read
runs-on: ubuntu-latest
steps:

It's better to scope perms to just the job and "blank out" default perms.


CRE_CHANGED=$(git diff --name-only "origin/${TARGET_BRANCH}" -- cre/)

if [ -z "$CRE_CHANGED" ]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ -z "$CRE_CHANGED" ]; then
if [[ -z "$CRE_CHANGED" ]]; then

Nit, but with bash it's always safer to use [[ for test/conditionals.

Comment on lines +35 to +38
if [ "$TARGET_BRANCH" != "main" ]; then
echo "PR targets '${TARGET_BRANCH}', not 'main'. CRE changes are allowed."
exit 0
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you just filter on on.pull_request.branches: [main]?

@amit-momin amit-momin force-pushed the cre/add-capability-development-branch-protection-ci branch 3 times, most recently from 721414a to a72b2e4 Compare March 25, 2026 19:18
Copy link

@chainchad chainchad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I would change all [ to [[ for the remaining bash conditionals but can be done in a follow-up or future.

@amit-momin amit-momin enabled auto-merge (squash) March 26, 2026 17:15
@amit-momin amit-momin merged commit 93f52c3 into main Mar 26, 2026
22 checks passed
@amit-momin amit-momin deleted the cre/add-capability-development-branch-protection-ci branch March 26, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants