fix: SSL Labs timeout + Lighthouse score variance #34
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: Auto-update PRs on base branch push | |
| on: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: auto-update-prs | |
| cancel-in-progress: true | |
| jobs: | |
| auto-update: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Update open PRs targeting main | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const { data: prs } = await github.rest.pulls.list({ | |
| owner, repo, base: 'main', state: 'open', per_page: 100, | |
| }); | |
| console.log(`Found ${prs.length} open PR(s) targeting main`); | |
| let updated = 0; | |
| for (const pr of prs) { | |
| if (pr.head.repo?.full_name !== `${owner}/${repo}`) { | |
| console.log(`Skipping PR #${pr.number} (fork): ${pr.title}`); | |
| continue; | |
| } | |
| try { | |
| await github.rest.pulls.updateBranch({ owner, repo, pull_number: pr.number }); | |
| console.log(`✓ Updated PR #${pr.number}: ${pr.title}`); | |
| updated++; | |
| } catch (e) { | |
| if (e.status === 422 || e.message?.toLowerCase().includes('already up to date')) { | |
| console.log(` PR #${pr.number} already up to date`); | |
| } else { | |
| console.error(`✗ PR #${pr.number} failed: ${e.message}`); | |
| } | |
| } | |
| } | |
| console.log(`Done: ${updated} updated.`); |