Add capability-development branch protection CI#327
Conversation
|
|
The latest Buf updates on your PR. Results from workflow Regenerate Protobuf Files / buf (pull_request).
|
359eb9d to
4396356
Compare
377d01d to
64301fe
Compare
| run: | | ||
| git fetch origin "${TARGET_BRANCH}" --quiet 2>/dev/null || true | ||
|
|
||
| CRE_CHANGED=$(git diff --name-only "origin/${TARGET_BRANCH}" -- cre/) |
There was a problem hiding this comment.
| 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
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| check-cre-target-branch: | ||
| runs-on: ubuntu-latest | ||
| steps: |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
| if [ -z "$CRE_CHANGED" ]; then | |
| if [[ -z "$CRE_CHANGED" ]]; then |
Nit, but with bash it's always safer to use [[ for test/conditionals.
| if [ "$TARGET_BRANCH" != "main" ]; then | ||
| echo "PR targets '${TARGET_BRANCH}', not 'main'. CRE changes are allowed." | ||
| exit 0 | ||
| fi |
There was a problem hiding this comment.
Should you just filter on on.pull_request.branches: [main]?
721414a to
a72b2e4
Compare
chainchad
left a comment
There was a problem hiding this comment.
LGTM! I would change all [ to [[ for the remaining bash conditionals but can be done in a follow-up or future.
No description provided.