Files
blackroad-os-prism-console/.github/workflows/branch-tracker.yml
Alexa Louise c4bc960c98 Add BlackRoad Completion Framework
- GitHub Actions workflows (auto-merge, branch-tracker, issue-to-board, stale-cleanup)
- Issue templates (agent-task, bug, task)
- PR template
- Automation scripts (slack-to-github, create-issue)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 07:40:24 -06:00

84 lines
2.7 KiB
YAML

name: Track Branch Activity
# When a branch is created that matches an issue number,
# automatically update the project board to show work has started
on:
create:
branches:
- 'issue-*'
- 'fix-*'
- 'feat-*'
push:
branches:
- 'issue-*'
- 'fix-*'
- 'feat-*'
permissions:
issues: write
repository-projects: write
jobs:
track-branch:
runs-on: ubuntu-latest
steps:
- name: Extract issue number from branch name
id: extract
run: |
BRANCH_NAME="${{ github.ref_name }}"
echo "Branch: $BRANCH_NAME"
# Extract issue number from branch name
# Supports: issue-123-description, fix-123-bug, feat-123-feature
ISSUE_NUM=$(echo "$BRANCH_NAME" | grep -oP '(?<=issue-|fix-|feat-)\d+' | head -1)
if [ -n "$ISSUE_NUM" ]; then
echo "issue_number=$ISSUE_NUM" >> $GITHUB_OUTPUT
echo "Found issue number: $ISSUE_NUM"
else
echo "No issue number found in branch name"
echo "issue_number=" >> $GITHUB_OUTPUT
fi
- name: Add 'in-progress' label to linked issue
if: steps.extract.outputs.issue_number != ''
uses: actions/github-script@v7
with:
script: |
const issueNumber = ${{ steps.extract.outputs.issue_number }};
try {
// Add in-progress label
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
labels: ['in-progress']
});
// Remove triage/inbox labels if present
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
name: 'triage'
});
} catch (e) {
// Label might not exist, that's fine
}
// Add comment showing work has started
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: `🚀 **Work started** on branch \`${{ github.ref_name }}\`\n\nActor: ${{ github.actor }}`
});
console.log(`Updated issue #${issueNumber} - work in progress`);
} catch (error) {
console.log(`Could not update issue #${issueNumber}: ${error.message}`);
}