Fix update gatsby fixture cron job (#9725)

This PR fixes the gatsby fixture update script to correctly create pull
requests after it updates the fixtures.
This commit is contained in:
Ethan Arrowood
2023-04-06 09:56:04 -06:00
committed by GitHub
parent 349df907a8
commit 46d0503361
2 changed files with 7 additions and 17 deletions

View File

@@ -8,7 +8,7 @@ on:
- cron: '0 0 * * 0'
jobs:
create-pull-request:
update-gatsby-fixtures:
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -16,9 +16,12 @@ jobs:
# 0 means fetch all commits so we can commit and push in the script below
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Enable corepack
run: corepack enable pnpm
- name: Create Pull Request
- name: Update Gatsby Fixtures
uses: actions/github-script@v6
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -81,10 +81,10 @@ module.exports = async ({ github, context }) => {
owner,
repo,
state: 'open',
head: branch,
head: `vercel:${branch}`,
});
if (pulls.length === 0) {
if (pulls.data.length === 0) {
const pr = await github.rest.pulls.create({
owner,
repo,
@@ -94,19 +94,6 @@ module.exports = async ({ github, context }) => {
body: 'Automatically generated PR to update Gatsby fixture versions in `@vercel/static-build`',
});
await github.rest.pulls.requestReviewers({
owner,
repo,
pull_number: pr.data.number,
reviewers: [
'Ethan-Arrowood',
'styfle',
'TooTallNate',
'EndangeredMassa',
'cb1kenobi',
],
});
await github.rest.issues.addLabels({
owner,
repo,