revert: remove migration-test repository entry #40
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: Repository Drift Detection | |
| # Use pull_request_target to run trusted workflow from base repository | |
| # This allows access to secrets while running code from main branch | |
| on: | |
| pull_request_target: | |
| jobs: | |
| detect-drift: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| steps: | |
| # Checkout the base repository (main branch) - trusted code | |
| - name: Checkout base repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| # Checkout PR's REPOSITORIES.md to see what changes are proposed | |
| - name: Checkout PR REPOSITORIES.md | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| sparse-checkout: | | |
| REPOSITORIES.md | |
| sparse-checkout-cone-mode: false | |
| path: pr-files | |
| # Copy PR's REPOSITORIES.md to working directory | |
| - name: Use PR's REPOSITORIES.md | |
| run: cp pr-files/REPOSITORIES.md REPOSITORIES.md | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Make scripts executable | |
| run: chmod +x scripts/*.js | |
| - name: Run drift detection | |
| id: drift | |
| env: | |
| WORLDDRIVEN_GITHUB_TOKEN: ${{ secrets.WORLDDRIVEN_GITHUB_TOKEN || github.token }} | |
| MIGRATE_APP_ID: ${{ secrets.MIGRATE_APP_ID }} | |
| MIGRATE_APP_PRIVATE_KEY: ${{ secrets.MIGRATE_APP_PRIVATE_KEY }} | |
| run: | | |
| set +e | |
| node scripts/detect-drift.js > drift-report.md 2>&1 | |
| EXIT_CODE=$? | |
| echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT | |
| set -e | |
| continue-on-error: true | |
| - name: Preview sync actions (dry-run) | |
| id: sync | |
| env: | |
| WORLDDRIVEN_GITHUB_TOKEN: ${{ secrets.WORLDDRIVEN_GITHUB_TOKEN || github.token }} | |
| MIGRATE_APP_ID: ${{ secrets.MIGRATE_APP_ID }} | |
| MIGRATE_APP_PRIVATE_KEY: ${{ secrets.MIGRATE_APP_PRIVATE_KEY }} | |
| run: | | |
| set +e | |
| node scripts/sync-repositories.js > sync-preview.md 2>&1 | |
| EXIT_CODE=$? | |
| echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT | |
| set -e | |
| continue-on-error: true | |
| - name: Add drift report to workflow summary | |
| if: always() | |
| run: | | |
| echo "## Repository Drift Detection Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| cat drift-report.md >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "---" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| cat sync-preview.md >> $GITHUB_STEP_SUMMARY | |
| - name: Comment PR with drift report and sync preview | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const driftReport = fs.readFileSync('drift-report.md', 'utf8'); | |
| const syncPreview = fs.readFileSync('sync-preview.md', 'utf8'); | |
| // Find existing comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes('Repository Drift Report') | |
| ); | |
| const commentBody = `${driftReport}\n\n---\n\n${syncPreview}\n\n---\n*🤖 This report is automatically generated on every PR that modifies REPOSITORIES.md*\n*The sync preview shows what actions will be applied when this PR is merged to main.*`; | |
| if (botComment) { | |
| // Update existing comment | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: commentBody, | |
| }); | |
| } else { | |
| // Create new comment | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: commentBody, | |
| }); | |
| } | |
| - name: Check drift detection result | |
| if: steps.drift.outputs.exit_code != '0' | |
| run: | | |
| echo "❌ Transfer blocked: worlddriven-migrate app not installed on source repository" | |
| echo "Review the drift report in the workflow summary above" | |
| echo "Install the worlddriven-migrate app on the source repository to unblock" | |
| exit 1 |