New script to track MUI to BUI migration
Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
name: MUI to BUI Migration Tracker
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run daily at midnight UTC
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
# Allow manual triggering
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-migration-progress:
|
||||
runs-on: ubuntu-latest
|
||||
name: Update Migration Progress Issue
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Run migration analysis
|
||||
id: analysis
|
||||
run: |
|
||||
# Run the migration script and save markdown output
|
||||
yarn mui-to-bui --markdown > migration-report.md
|
||||
|
||||
# Read the report into an environment variable (escape for GitHub Actions)
|
||||
echo "REPORT<<EOF" >> $GITHUB_ENV
|
||||
cat migration-report.md >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Update GitHub Issue
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const issueNumber = 31467;
|
||||
const reportBody = process.env.REPORT;
|
||||
|
||||
try {
|
||||
await github.rest.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issueNumber,
|
||||
body: reportBody
|
||||
});
|
||||
|
||||
console.log(`✅ Successfully updated issue #${issueNumber}`);
|
||||
} catch (error) {
|
||||
console.error(`❌ Error updating issue: ${error.message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
- name: Comment on success
|
||||
if: success()
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const issueNumber = 31467;
|
||||
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
|
||||
|
||||
// Only comment if manually triggered (not on schedule)
|
||||
if (context.eventName === 'workflow_dispatch') {
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issueNumber,
|
||||
body: `🔄 Migration report updated manually. [View workflow run](${runUrl})`
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user