Unverified Commit 79511317 authored by Justin Ridgewell's avatar Justin Ridgewell Committed by GitHub

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.
parent adc636dd
# 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.
...@@ -36,6 +36,10 @@ jobs: ...@@ -36,6 +36,10 @@ jobs:
- name: Create Pull Request - name: Create Pull Request
shell: bash shell: bash
run: node scripts/update-fonts-data-workflow.js run: node scripts/automated-update-workflow.js
env: env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }} GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
BRANCH_NAME: fonts-data
SCRIPT: scripts/update-google-fonts.js
PR_TITLE: Update font data
PR_BODY: This auto-generated PR updates font data with latest available
...@@ -4,18 +4,28 @@ const { exec: execOriginal } = require('child_process') ...@@ -4,18 +4,28 @@ const { exec: execOriginal } = require('child_process')
const exec = promisify(execOriginal) 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) { if (!GITHUB_TOKEN) {
console.log('missing GITHUB_TOKEN env') console.log('missing GITHUB_TOKEN env')
process.exit(1) process.exit(1)
} }
if (!SCRIPT) {
console.log('missing SCRIPT env')
process.exit(1)
}
async function main() { async function main() {
const octokit = new Octokit({ auth: GITHUB_TOKEN }) 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.name "vercel-release-bot"`)
await exec(`git config user.email "infra+release@vercel.com"`) await exec(`git config user.email "infra+release@vercel.com"`)
...@@ -52,14 +62,14 @@ async function main() { ...@@ -52,14 +62,14 @@ async function main() {
repo, repo,
head: branchName, head: branchName,
base: 'canary', base: 'canary',
title: `Update font data`, title: PR_TITLE,
body: `This auto-generated PR updates font data with latest available`, body: PR_BODY,
}) })
console.log('Created pull request', pullRequest.url) console.log('Created pull request', pullRequest.url)
const previousPullRequests = pullRequests.filter(({ title }) => { const previousPullRequests = pullRequests.filter(({ title, user }) => {
return title.startsWith('Update font data') return title.includes(PR_TITLE) && user.login === 'vercel-release-bot'
}) })
if (previousPullRequests.length) { if (previousPullRequests.length) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment