docs(migration): add automation handoff #2
Workflow file for this run
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: Migration Docs Update | ||
| on: | ||
| push: | ||
| branches: [ yubikit ] | ||
| workflow_dispatch: | ||
| # GitHub only runs scheduled workflows from the repository default branch. | ||
| # Keep this trigger here for when the workflow is mirrored to the default branch | ||
| # or the repository default branch changes to yubikit. | ||
| schedule: | ||
| - cron: '17 3 * * 1' | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| concurrency: | ||
| group: migration-docs-update-yubikit | ||
| cancel-in-progress: false | ||
| jobs: | ||
| update: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out source | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: yubikit | ||
| - name: Fetch migration baselines | ||
| run: | | ||
| git fetch origin +refs/heads/develop:refs/remotes/origin/develop | ||
| git fetch origin +refs/heads/yubikit:refs/remotes/origin/yubikit | ||
| - name: Resolve migration range | ||
| id: range | ||
| shell: bash | ||
| run: | | ||
| state_path='docs/migration/.state.yml' | ||
| if [[ -f "$state_path" ]]; then | ||
| last=$(sed -n 's/^last_analyzed_commit:[[:space:]]*//p' "$state_path" | head -n 1) | ||
| else | ||
| last='' | ||
| fi | ||
| if [[ -z "$last" ]]; then | ||
| last='origin/yubikit^' | ||
| fi | ||
| echo "base_range=$last..HEAD" >> "$GITHUB_OUTPUT" | ||
| - name: Build migration context | ||
| shell: bash | ||
| run: | | ||
| bash ./scripts/migration/build-migration-context.sh \ | ||
| --mode update \ | ||
| --v1-baseline origin/develop \ | ||
| --v2-branch origin/yubikit \ | ||
| --base-range '${{ steps.range.outputs.base_range }}' \ | ||
| --output-dir .migration-context | ||
| - name: Update migration documentation | ||
| uses: anthropics/claude-code-action@beta | ||
| with: | ||
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| prompt: | | ||
| Read and follow `.github/prompts/migration-docs-post-merge.md`. | ||
| The generated context is in `.migration-context/`. | ||
| Update only the allowed migration documentation files. | ||
| claude_args: >- | ||
| --allowedTools Read,Grep,Glob,Edit,Write | ||
| - name: Create migration documentation PR | ||
| uses: peter-evans/create-pull-request@v7 | ||
| with: | ||
| branch: automation/migration-docs-update | ||
| base: yubikit | ||
| title: Update v1 to v2 migration documentation | ||
| commit-message: docs: update migration documentation | ||
| body: | | ||
| Automated migration documentation update for `${{ steps.range.outputs.base_range }}`. | ||
| Review the generated guide, map, changelog, and state changes before merging. | ||
| add-paths: | | ||
| docs/migration/v1-to-v2.md | ||
| docs/migration/v1-to-v2-map.yml | ||
| docs/migration/v1-to-v2-changelog.md | ||
| docs/migration/.state.yml | ||