Skip to content

Commit b91cb84

Browse files
committed
Remove use of compromised action
1 parent d881aea commit b91cb84

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

.github/workflows/build-deps.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,35 @@ jobs:
8585

8686
# On pull requests, ensure that changed files are determined before checking out the code so
8787
# that we use the GitHub API, otherwise we would have to fetch the entire history (depth: 0)
88-
- name: Get changed files
88+
- name: Check for builder changes (pull request)
89+
id: changed-files-pr
90+
if: github.event_name == 'pull_request'
91+
run: |
92+
PR_NUMBER="${{ github.event.pull_request.number }}"
93+
REPO="${{ github.repository }}"
94+
95+
BUILDERS_CHANGED=$(gh api --paginate "repos/$REPO/pulls/$PR_NUMBER/files" | \
96+
jq -r 'map(.filename) | map(select(startswith(".builders/"))) | length > 0')
97+
98+
echo "builders_any_changed=$BUILDERS_CHANGED" >> $GITHUB_OUTPUT
99+
100+
# For push events, we still need to check changes but will rely on minimal checkout
101+
- name: Check for builder changes (push)
102+
id: changed-files-push
103+
if: github.event_name != 'pull_request'
104+
run: |
105+
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
106+
echo "builders_any_changed=$(echo "$CHANGED_FILES" | grep -q "^\.builders/" && echo "true" || echo "false")" >> $GITHUB_OUTPUT
107+
108+
# Combine outputs for subsequent steps
109+
- name: Combine changed files outputs
89110
id: changed-files
90-
uses: tj-actions/changed-files@v42
91-
with:
92-
files_yaml: |-
93-
builders:
94-
- .builders/**
95-
dependencies:
96-
- ${{ env.DIRECT_DEPENDENCY_FILE }}
111+
run: |
112+
if [ "${{ github.event_name }}" == "pull_request" ]; then
113+
echo "builders_any_changed=${{ steps.changed-files-pr.outputs.builders_any_changed }}" >> $GITHUB_OUTPUT
114+
else
115+
echo "builders_any_changed=${{ steps.changed-files-push.outputs.builders_any_changed }}" >> $GITHUB_OUTPUT
116+
fi
97117
98118
- name: Checkout code
99119
if: github.event_name == 'pull_request'

0 commit comments

Comments
 (0)