fix(bot): improve patch resilience in brain workflow

- Pin publish job to the specific SHA from reasoning job to avoid drift.

- Use git apply --3way --ignore-whitespace for better conflict resolution.
This commit is contained in:
Christian Gunderman
2026-05-13 20:34:56 -07:00
parent 5dc5b4ed4a
commit 928ce879ea
+8 -18
View File
@@ -58,6 +58,8 @@ jobs:
contents: 'read'
issues: 'read'
actions: 'read'
outputs:
sha: ${{ steps.get_sha.outputs.sha }}
env:
GEMINI_CLI_TRUST_WORKSPACE: 'true'
steps:
@@ -84,6 +86,10 @@ jobs:
fetch-depth: 0
persist-credentials: false
- name: 'Get Current SHA'
id: 'get_sha'
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: 'Setup Node.js'
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions/setup-node@v4
with:
@@ -296,26 +302,10 @@ jobs:
permission-pull-requests: 'write'
permission-issues: 'write'
- name: 'Determine Checkout Ref'
id: 'determine_ref'
env:
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
ISSUE_NUMBER: '${{ github.event.issue.number || github.event.inputs.issue_number }}'
run: |
REF="main"
if [ -n "$ISSUE_NUMBER" ]; then
PR_HEAD=$(gh pr view "$ISSUE_NUMBER" --repo "${{ github.repository }}" --json headRefName --jq .headRefName 2>/dev/null || echo "")
if [ -n "$PR_HEAD" ]; then
REF="$PR_HEAD"
fi
fi
echo "ref=$REF" >> "$GITHUB_OUTPUT"
- name: 'Checkout'
uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5
with:
ref: '${{ steps.determine_ref.outputs.ref }}'
ref: '${{ needs.reasoning.outputs.sha }}'
fetch-depth: 0
persist-credentials: false
@@ -347,7 +337,7 @@ jobs:
fi
git checkout -B "$BRANCH_NAME"
git apply "${{ runner.temp }}/brain-data/bot-changes.patch"
git apply --3way --ignore-whitespace "${{ runner.temp }}/brain-data/bot-changes.patch"
git add .
PR_TITLE="🤖 Gemini Bot Maintenance Update"