|
| 1 | +--- |
| 2 | +name: Branding & Documentation Refresh |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + scope: |
| 8 | + description: 'Scope of branding update (all, badges, headers, indices)' |
| 9 | + required: false |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - all |
| 13 | + - badges |
| 14 | + - headers |
| 15 | + - indices |
| 16 | + default: 'all' |
| 17 | + dry_run: |
| 18 | + description: 'Dry run (preview changes without committing)' |
| 19 | + required: false |
| 20 | + type: boolean |
| 21 | + default: true |
| 22 | + schedule: |
| 23 | + # Run weekly on Monday at 00:00 UTC |
| 24 | + - cron: '0 0 * * 1' |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: write |
| 28 | + pull-requests: write |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: branding-${{ github.workflow }}-${{ github.ref }} |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +env: |
| 35 | + BRANDING_AGENT: .github/agents/branding.agent.js |
| 36 | + BADGES_AGENT: .github/agents/badges.agent.js |
| 37 | + HEADER_FOOTER_AGENT: .github/agents/header-footer.agent.js |
| 38 | + |
| 39 | +jobs: |
| 40 | + branding-update: |
| 41 | + name: Update Branding (${{ inputs.scope || 'scheduled' }}) |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout code |
| 46 | + uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + fetch-depth: 0 |
| 49 | + ref: develop |
| 50 | + |
| 51 | + - name: Set up Node.js |
| 52 | + uses: actions/setup-node@v4 |
| 53 | + with: |
| 54 | + node-version: '20' |
| 55 | + cache: 'npm' |
| 56 | + |
| 57 | + - name: Install dependencies |
| 58 | + run: npm ci --prefer-offline --no-audit |
| 59 | + |
| 60 | + - name: Determine scope |
| 61 | + id: scope |
| 62 | + run: | |
| 63 | + SCOPE="${{ inputs.scope || 'all' }}" |
| 64 | + echo "scope=$SCOPE" >> "$GITHUB_OUTPUT" |
| 65 | + echo "Branding scope: $SCOPE" |
| 66 | +
|
| 67 | + - name: Run branding agent (all or badges) |
| 68 | + if: ${{ steps.scope.outputs.scope == 'all' || steps.scope.outputs.scope == 'badges' }} |
| 69 | + run: | |
| 70 | + if [ -f "${{ env.BADGES_AGENT }}" ]; then |
| 71 | + node "${{ env.BADGES_AGENT }}" |
| 72 | + else |
| 73 | + echo "⚠️ Badges agent not found, skipping..." |
| 74 | + fi |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + DRY_RUN: ${{ inputs.dry_run || 'false' }} |
| 78 | + |
| 79 | + - name: Run header/footer updates (all or headers) |
| 80 | + if: ${{ steps.scope.outputs.scope == 'all' || steps.scope.outputs.scope == 'headers' }} |
| 81 | + run: | |
| 82 | + if [ -f "${{ env.HEADER_FOOTER_AGENT }}" ]; then |
| 83 | + node "${{ env.HEADER_FOOTER_AGENT }}" |
| 84 | + else |
| 85 | + echo "⚠️ Header/footer agent not found, skipping..." |
| 86 | + fi |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + DRY_RUN: ${{ inputs.dry_run || 'false' }} |
| 90 | + |
| 91 | + - name: Refresh documentation indices (all or indices) |
| 92 | + if: ${{ steps.scope.outputs.scope == 'all' || steps.scope.outputs.scope == 'indices' }} |
| 93 | + run: | |
| 94 | + # Update docs/README.md with navigation |
| 95 | + cat > docs/README.md << 'EOF' |
| 96 | +# Documentation Index |
| 97 | + |
| 98 | +Welcome to the LightSpeed `.github` repository documentation. |
| 99 | + |
| 100 | +## Quick Links |
| 101 | + |
| 102 | +- [Workflows](./WORKFLOWS.md) - GitHub Actions workflows |
| 103 | +- [Labels](./labels.md) - Canonical label definitions |
| 104 | +- [Agents](../AGENTS.md) - AI agent specifications |
| 105 | +- [Project Boards](./ls-projects/) - Project management |
| 106 | +- [Discussions](./DISCUSSIONS.md) - Community discussions |
| 107 | + |
| 108 | +## Documentation Sections |
| 109 | + |
| 110 | +### Configuration & Setup |
| 111 | +- [Architecture](./ARCHITECTURE.md) |
| 112 | +- [Coding Style](./CODING-STYLE.md) |
| 113 | +- [Development](../DEVELOPMENT.md) |
| 114 | +- [Versioning](./VERSIONING.md) |
| 115 | + |
| 116 | +### Workflows & Automation |
| 117 | +- [Workflows Overview](./WORKFLOWS.md) |
| 118 | +- [Labeling Strategy](./LABEL_STRATEGY.md) |
| 119 | +- [Labeling Agent Usage](./LABELING_AGENT_USAGE.md) |
| 120 | +- [Release Process](./RELEASE-PROCESS.md) |
| 121 | + |
| 122 | +### Testing & Quality |
| 123 | +- [Testing Guide](./TESTING.md) |
| 124 | +- [Linting](./LINTING.md) |
| 125 | +- [Jest Test Audit](./JEST-TEST-AUDIT.md) |
| 126 | + |
| 127 | +### AI & Prompts |
| 128 | +- [AI Documentation](./ai/) |
| 129 | +- [Chatmode Frontmatter](./CHATMODE-FRONTMATTER.md) |
| 130 | +- [Copilot Usage](./COPILOT-USAGE.md) |
| 131 | + |
| 132 | +### Contributing |
| 133 | +- [Contributing Guide](../CONTRIBUTING.md) |
| 134 | +- [Issue Creation Guide](./ISSUE_CREATION_GUIDE.md) |
| 135 | +- [PR Creation Process](./PR_CREATION_PROCESS.md) |
| 136 | +- [Contributing Templates](./CONTRIBUTING-TEMPLATES.md) |
| 137 | + |
| 138 | +### Organization |
| 139 | +- [Organization Guide](./ORGANIZATION.md) |
| 140 | +- [Decisions](./DECISIONS.md) |
| 141 | +- [Roadmap](./ROADMAP.md) |
| 142 | + |
| 143 | +### Security & Governance |
| 144 | +- [Security Policy](../SECURITY.md) |
| 145 | +- [Code of Conduct](../CODE_OF_CONDUCT.md) |
| 146 | +- [Governance](../GOVERNANCE.md) |
| 147 | +- [Security & Licensing](./SECURITY-AND-LICENSING.md) |
| 148 | + |
| 149 | +## Additional Resources |
| 150 | + |
| 151 | +- [Override Policy](./override-policy.md) - Downstream repo customization |
| 152 | +- [Downstream Adoption Guide](./downstream/tour-operator-adoption.md) |
| 153 | +- [Badges Guide](./BADGES.md) |
| 154 | +- [Header/Footer Guidelines](./HEADER-FOOTER.md) |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +*Last updated: $(date +%Y-%m-%d) by Branding Automation* |
| 159 | +EOF |
| 160 | + echo "✅ Documentation index updated" |
| 161 | + |
| 162 | + - name: Check for changes |
| 163 | + id: changes |
| 164 | + run: | |
| 165 | + if git diff --quiet; then |
| 166 | + echo "has_changes=false" >> "$GITHUB_OUTPUT" |
| 167 | + echo "ℹ️ No branding changes detected" |
| 168 | + else |
| 169 | + echo "has_changes=true" >> "$GITHUB_OUTPUT" |
| 170 | + echo "✅ Branding changes detected" |
| 171 | + git diff --stat |
| 172 | + fi |
| 173 | +
|
| 174 | + - name: Preview changes (dry run) |
| 175 | + if: ${{ inputs.dry_run && steps.changes.outputs.has_changes == 'true' }} |
| 176 | + run: | |
| 177 | + echo "### 📄 Branding Changes Preview" >> $GITHUB_STEP_SUMMARY |
| 178 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 179 | + echo '```diff' >> $GITHUB_STEP_SUMMARY |
| 180 | + git diff | head -100 >> $GITHUB_STEP_SUMMARY |
| 181 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 182 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 183 | + echo "**Scope:** ${{ steps.scope.outputs.scope }}" >> $GITHUB_STEP_SUMMARY |
| 184 | + echo "**Dry Run:** true" >> $GITHUB_STEP_SUMMARY |
| 185 | +
|
| 186 | + - name: Commit and push changes |
| 187 | + if: ${{ !inputs.dry_run && steps.changes.outputs.has_changes == 'true' }} |
| 188 | + run: | |
| 189 | + git config --local user.email "[email protected]" |
| 190 | + git config --local user.name "GitHub Action" |
| 191 | +
|
| 192 | + SCOPE="${{ steps.scope.outputs.scope }}" |
| 193 | + git add . |
| 194 | + git commit -m "chore(branding): refresh $SCOPE documentation [skip ci]" |
| 195 | + git push origin develop |
| 196 | +
|
| 197 | + - name: Create summary |
| 198 | + if: always() |
| 199 | + run: | |
| 200 | + echo "### Branding Update Summary" >> $GITHUB_STEP_SUMMARY |
| 201 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 202 | + echo "**Scope:** ${{ steps.scope.outputs.scope }}" >> $GITHUB_STEP_SUMMARY |
| 203 | + echo "**Dry Run:** ${{ inputs.dry_run || 'false' }}" >> $GITHUB_STEP_SUMMARY |
| 204 | + echo "**Changes:** ${{ steps.changes.outputs.has_changes }}" >> $GITHUB_STEP_SUMMARY |
| 205 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 206 | + if [ "${{ steps.changes.outputs.has_changes }}" = "true" ]; then |
| 207 | + if [ "${{ inputs.dry_run }}" = "true" ]; then |
| 208 | + echo "✅ Preview generated. Run with dry_run=false to apply changes." |
| 209 | + else |
| 210 | + echo "✅ Branding updates committed and pushed to develop." |
| 211 | + fi |
| 212 | + else |
| 213 | + echo "ℹ️ No changes needed." |
| 214 | + fi |
| 215 | +
|
| 216 | +# TODO: Add automated PR creation for branding changes |
| 217 | +# TODO: Add notification to Slack/Discord when branding updates are applied |
0 commit comments