fix: add write permissions to sync-docs workflow #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Documentation from bd Tracker | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write # Allow workflow to push commits | |
| jobs: | |
| sync-docs: | |
| name: Auto-sync planning documents | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history for accurate git operations | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| persist-credentials: true | |
| - name: Set up bd (Beads) | |
| run: | | |
| # Install bd if not available | |
| if ! command -v bd &> /dev/null; then | |
| echo "Installing bd (Beads) issue tracker..." | |
| # Add installation commands here when bd has a proper installer | |
| # For now, assume bd is available or installed via package | |
| fi | |
| bd --version || echo "bd not installed, will use existing files" | |
| - name: Export Current Sprint | |
| run: | | |
| chmod +x ./scripts/export-current-sprint.sh | |
| ./scripts/export-current-sprint.sh | |
| continue-on-error: true | |
| - name: Export Implementation Plan | |
| run: | | |
| chmod +x ./scripts/export-implementation-plan.sh | |
| ./scripts/export-implementation-plan.sh | |
| continue-on-error: true | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| git diff --quiet CURRENT_SPRINT.md IMPLEMENTATION_PLAN.md || echo "changes=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push if changed | |
| if: steps.check_changes.outputs.changes == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add CURRENT_SPRINT.md IMPLEMENTATION_PLAN.md | |
| git commit -m "docs: auto-sync planning docs from bd tracker | |
| Auto-generated by GitHub Actions workflow. | |
| 🤖 Generated with [Claude Code](https://claude.com/claude-code) | |
| " | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Summary | |
| run: | | |
| if [ "${{ steps.check_changes.outputs.changes }}" == "true" ]; then | |
| echo "✅ Documentation synced successfully" | |
| else | |
| echo "ℹ️ No changes detected - documentation already up to date" | |
| fi |