Skip to content

Commit 16d0b1e

Browse files
authored
chore(ci): reduce frequency of buflint rate limiting (#2899)
### Proposed Changes * Only runs `buflint` job when any `.proto` file is changed within the PR * Buflint job successfully fails as expected when a `.proto` file is improperly changed: https://github.com/opentdf/platform/actions/runs/19311694249/job/55233303833?pr=2899 ### Checklist - [ ] I have added or updated unit tests - [ ] I have added or updated integration tests (if appropriate) - [ ] I have added or updated documentation ### Testing Instructions
1 parent 802db02 commit 16d0b1e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/checks.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,32 @@ jobs:
370370
env:
371371
BENCHMARK_MARKDOWN: ${{ needs.benchmark.outputs.markdown }}
372372

373+
changes:
374+
permissions:
375+
contents: read
376+
runs-on: ubuntu-22.04
377+
outputs:
378+
proto: ${{ steps.check.outputs.proto }}
379+
steps:
380+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
381+
with:
382+
fetch-depth: 0
383+
persist-credentials: false
384+
- name: Check for proto file changes
385+
id: check
386+
run: |
387+
if [ "${{ github.event_name }}" = "pull_request" ]; then
388+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
389+
if git diff --name-only "$BASE_SHA" HEAD | grep -q '\.proto$'; then
390+
echo "proto=true" >> "$GITHUB_OUTPUT"
391+
else
392+
echo "proto=false" >> "$GITHUB_OUTPUT"
393+
fi
394+
else
395+
# For non-PR events (push, merge_group), always run
396+
echo "proto=true" >> "$GITHUB_OUTPUT"
397+
fi
398+
373399
image:
374400
permissions:
375401
contents: read
@@ -480,6 +506,8 @@ jobs:
480506
TESTRAIL_PASS: ${{ secrets.TESTRAIL_PASS }}
481507

482508
buflint:
509+
needs: changes
510+
if: needs.changes.outputs.proto == 'true' || github.event_name != 'pull_request'
483511
permissions:
484512
contents: read
485513
name: Protocol Buffer Lint and Gencode Up-to-date check

0 commit comments

Comments
 (0)