chore: trigger issue-labels-sync workflow #2
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: Migrate Legacy Labels | ||
| on: | ||
| schedule: | ||
| - cron: '0 7 * * *' # Daily at 07:00 UTC (runs before label sync at 08:00) | ||
| workflow_dispatch: | ||
| permissions: | ||
| issues: write | ||
| jobs: | ||
| migrate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Rename legacy labels to type: equivalents | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| // Legacy label → canonical type: label. | ||
| // Rename preserves all issue associations automatically. | ||
| const MIGRATIONS = [ | ||
| { from: 'bug', to: 'type:bug' }, | ||
| { from: 'question', to: 'type:question' }, | ||
| { from: 'enhancement', to: 'type:enhancement' }, | ||
| { from: 'documentation', to: 'type:documentation' } | ||
| ]; | ||
| for (const { from, to } of MIGRATIONS) { | ||
| try { | ||
| await github.rest.issues.getLabel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| name: from | ||
| }); | ||
| // Old label exists — rename it | ||
| await github.rest.issues.updateLabel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| name: from, | ||
| new_name: to | ||
| }); | ||
| core.info(`Migrated label: ${from} → ${to}`); | ||
| } catch (err) { | ||
| if (err.status === 404) { | ||
| core.info(`Legacy label "${from}" not found — no migration needed`); | ||
| } else { | ||
| core.warning(`Failed to migrate ${from}: ${err.message}`); | ||
| } | ||
| } | ||
| } | ||
| core.info('Label migration complete'); | ||