diff --git a/.github/workflows/gemini-cli-bot-brain.yml b/.github/workflows/gemini-cli-bot-brain.yml index c4743e4479..9632be323a 100644 --- a/.github/workflows/gemini-cli-bot-brain.yml +++ b/.github/workflows/gemini-cli-bot-brain.yml @@ -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"