Skip to content

Commit cbdbc48

Browse files
fix: Fix git path issue in PR creation step
Work from repo root instead of backend directory for git operations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent beb4ed9 commit cbdbc48

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/security-guard.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,13 @@ jobs:
219219
env:
220220
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
221221
run: |
222-
# Check for changes in backend
223-
cd backend
222+
# Work from repo root
224223
git config user.name "github-actions[bot]"
225224
git config user.email "github-actions[bot]@users.noreply.github.com"
226225
227-
if git diff --quiet -- . ':!manifest.json' ':!security-report.json'; then
228-
echo "No code changes to commit"
226+
# Check for Python file changes
227+
if ! git diff --name-only | grep -q '\.py$'; then
228+
echo "No Python file changes to commit"
229229
echo "pr_created=false" >> $GITHUB_OUTPUT
230230
exit 0
231231
fi
@@ -234,8 +234,8 @@ jobs:
234234
BRANCH_NAME="fix/security-$(date +%Y%m%d-%H%M%S)"
235235
git checkout -b "$BRANCH_NAME"
236236
237-
# Commit ONLY the Python files that were fixed (exclude workflow, manifest, reports)
238-
git diff --name-only HEAD | grep '\.py$' | xargs -r git add
237+
# Commit ONLY the Python files that were fixed
238+
git diff --name-only | grep '\.py$' | xargs git add
239239
git commit -m "fix: Security vulnerability fixes
240240
241241
Automated fixes by UnitOneFlow Security Guard.
@@ -247,7 +247,7 @@ jobs:
247247
# Push branch
248248
git push -u origin "$BRANCH_NAME"
249249
250-
# Create PR
250+
# Create PR (use cd to go back to repo root for gh command)
251251
PR_URL=$(gh pr create \
252252
--title "[Security] Fix ${{ steps.detect.outputs.count }} vulnerability(s)" \
253253
--body "## Security Vulnerability Fixes

0 commit comments

Comments
 (0)