Replies: 1 comment
-
|
There's no built-in way to set That said, you can work around this with a bit of GitHub Actions scripting. The idea: parse the branch name from the issue body or a label, then pass it to the action. Option 1: Parse from issue body Ask developers to include a jobs:
claude:
runs-on: ubuntu-latest
steps:
- name: Extract base branch
id: branch
run: |
BASE=$(echo "$ISSUE_BODY" | grep -oP '(?<=base:\s)\S+' || echo "main")
echo "name=$BASE" >> $GITHUB_OUTPUT
env:
ISSUE_BODY: ${{ github.event.issue.body }}
- uses: anthropics/claude-code-action@v1
with:
base_branch: ${{ steps.branch.outputs.name }}
# ... rest of configOption 2: Use labels as branch selectors Create labels like - name: Branch from label
id: branch
run: |
LABELS="${{ join(github.event.issue.labels.*.name, ',') }}"
if echo "$LABELS" | grep -q 'base:staging'; then
echo "name=staging" >> $GITHUB_OUTPUT
elif echo "$LABELS" | grep -q 'base:develop'; then
echo "name=develop" >> $GITHUB_OUTPUT
else
echo "name=main" >> $GITHUB_OUTPUT
fiBoth approaches keep the workflow file generic — no hardcoding per developer. The label approach is cleaner since it's visible at a glance and doesn't require a specific format in the issue body. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m using Claude Code with GitHub Actions in “mention” mode — when I write @ claude in a GitHub issue, it will always takes the main/master default branch as the "base_branch".
Is there a way to tell Claude which side branch to checkout from as the "base_branch" from the "issues" tab in Github?
(I do not want to statically hardcode base_branch in the github action file as it will affect all other developers using this repo.
Beta Was this translation helpful? Give feedback.
All reactions