-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically update Turbopack test manifest (#57778)
### What? This PR adds an hourly workflow that will update the test manifest used when testing with Turbopack. ### Why? To ensure we don't regress any test suites. ### How? I use the existing `scripts/update-fonts-data-workflow.js` workflow script which will execute a script, then create a PR with the current working tree. If any pending automated PRs exist, they will be closed when a new one is opened.
- Loading branch information
1 parent
adc636d
commit 7951131
Showing
3 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# A recurring workflow which updates the passing/failing/skipped integration tests for Turbopack. | ||
name: Update Turbopack test manifest | ||
|
||
on: | ||
schedule: | ||
# Every hour | ||
- cron: '0 * * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update_manifest: | ||
name: Update and upload Turbopack test manifest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
# Commits made with the default `GITHUB_TOKEN` won't trigger workflows. | ||
# See: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow | ||
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_LTS_VERSION }} | ||
check-latest: true | ||
|
||
- name: Create Pull Request | ||
shell: bash | ||
run: node scripts/automated-update-workflow.js | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }} | ||
BRANCH_NAME: fonts-data | ||
SCRIPT: test/build-turbopack-tests-manifest.js | ||
PR_TITLE: Update Turbopack test manifest | ||
PR_BODY: This auto-generated PR updates the integration test manifest used when testing Turbopack. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,28 @@ const { exec: execOriginal } = require('child_process') | |
|
||
const exec = promisify(execOriginal) | ||
|
||
const GITHUB_TOKEN = process.env.GITHUB_TOKEN || '' | ||
const { | ||
GITHUB_TOKEN = '', | ||
SCRIPT = '', | ||
BRANCH_NAME = 'unknown', | ||
PR_TITLE = 'Automated update', | ||
PR_BODY = '', | ||
} = process.env | ||
|
||
if (!GITHUB_TOKEN) { | ||
console.log('missing GITHUB_TOKEN env') | ||
process.exit(1) | ||
} | ||
if (!SCRIPT) { | ||
console.log('missing SCRIPT env') | ||
process.exit(1) | ||
} | ||
|
||
async function main() { | ||
const octokit = new Octokit({ auth: GITHUB_TOKEN }) | ||
const branchName = `update/fonts-data-${Date.now()}` | ||
const branchName = `update/${BRANCH_NAME}-${Date.now()}` | ||
|
||
await exec(`node scripts/update-google-fonts.js`) | ||
await exec(`node ${SCRIPT}`) | ||
|
||
await exec(`git config user.name "vercel-release-bot"`) | ||
await exec(`git config user.email "[email protected]"`) | ||
|
@@ -52,14 +62,14 @@ async function main() { | |
repo, | ||
head: branchName, | ||
base: 'canary', | ||
title: `Update font data`, | ||
body: `This auto-generated PR updates font data with latest available`, | ||
title: PR_TITLE, | ||
body: PR_BODY, | ||
}) | ||
|
||
console.log('Created pull request', pullRequest.url) | ||
|
||
const previousPullRequests = pullRequests.filter(({ title }) => { | ||
return title.startsWith('Update font data') | ||
const previousPullRequests = pullRequests.filter(({ title, user }) => { | ||
return title.includes(PR_TITLE) && user.login === 'vercel-release-bot' | ||
}) | ||
|
||
if (previousPullRequests.length) { | ||
|