Skip to content

Commit f78d8f7

Browse files
committed
fix(actions): fix checkout issues
1 parent fa1ed04 commit f78d8f7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/generate-readme-remote.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,29 @@ jobs:
6464
echo "Cherry-picking: $(git log --oneline -1 $commit)"
6565
# Cherry-pick but only allow changes to specific paths for security
6666
if git cherry-pick --no-commit $commit; then
67-
# Reset any files that aren't in our allowed paths
67+
# Get list of changed files in this commit
68+
CHANGED_FILES=$(git diff --staged --name-only)
69+
echo "Files changed in commit: $CHANGED_FILES"
70+
71+
# Reset everything first
6872
git reset HEAD -- . || true
69-
git checkout HEAD -- . || true
70-
git add code_of_conduct/ || true
71-
git add pyproject.toml || true
73+
74+
# Only add back files in allowed paths
75+
echo "$CHANGED_FILES" | while read -r file; do
76+
if [[ "$file" == code_of_conduct/* ]] || [[ "$file" == "pyproject.toml" ]]; then
77+
echo "Allowing file: $file"
78+
git add "$file" || true
79+
fi
80+
done
7281
7382
# Only commit if there are staged changes
7483
if ! git diff --staged --quiet; then
7584
git commit --reuse-message=$commit
85+
echo "Committed filtered changes from $commit"
7686
else
7787
echo "No allowed changes in commit $commit, skipping"
88+
# Clean up any remaining unstaged changes
89+
git checkout HEAD -- . || true
7890
fi
7991
else
8092
echo "Failed to cherry-pick $commit, skipping"

0 commit comments

Comments
 (0)