Skip to content

Commit

Permalink
Meta: ensure the IPR check runs on the PR head, not main (#3480)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 16, 2024
1 parent 5881c1f commit 0b6c5f1
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@6bc39109c48f74895ad72ec03ca0bb4e4da2fa3f
- uses: ljharb/actions/node/install@dfd9796898850cf07630d1bd4053a7c9a379e90f
name: 'nvm install lts/* && npm ci --no-audit'
env:
NPM_CONFIG_AUDIT: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@6bc39109c48f74895ad72ec03ca0bb4e4da2fa3f
- uses: ljharb/actions/node/install@dfd9796898850cf07630d1bd4053a7c9a379e90f
name: 'nvm install lts/* && npm ci --no-audit'
env:
NPM_CONFIG_AUDIT: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/enforce-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@6bc39109c48f74895ad72ec03ca0bb4e4da2fa3f
- uses: ljharb/actions/node/install@dfd9796898850cf07630d1bd4053a7c9a379e90f
name: 'nvm install lts/* && npm ci --no-audit'
env:
NPM_CONFIG_AUDIT: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ipr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@6bc39109c48f74895ad72ec03ca0bb4e4da2fa3f
- uses: ljharb/actions/node/install@dfd9796898850cf07630d1bd4053a7c9a379e90f
name: 'nvm install lts/* && npm ci --no-audit'
env:
NPM_CONFIG_AUDIT: false
with:
node-version: lts/*
use-npm-ci: true
- run: 'npm run ipr-check'
- run: npm run ipr-check ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'HEAD' }}
env:
GH_TOKEN: ${{ secrets.GH_IPR_TOKEN }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@6bc39109c48f74895ad72ec03ca0bb4e4da2fa3f
- uses: ljharb/actions/node/install@dfd9796898850cf07630d1bd4053a7c9a379e90f
name: 'nvm install lts/* && npm ci --no-audit'
env:
NPM_CONFIG_AUDIT: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ljharb/actions/node/install@6bc39109c48f74895ad72ec03ca0bb4e4da2fa3f
- uses: ljharb/actions/node/install@dfd9796898850cf07630d1bd4053a7c9a379e90f
name: 'nvm install lts/* && npm ci --no-audit'
env:
NPM_CONFIG_AUDIT: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# Default: 1
fetch-depth: 0
- uses: ljharb/actions/node/install@6bc39109c48f74895ad72ec03ca0bb4e4da2fa3f
- uses: ljharb/actions/node/install@dfd9796898850cf07630d1bd4053a7c9a379e90f
name: 'nvm install lts/* && npm ci --no-audit'
env:
NPM_CONFIG_AUDIT: false
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"description": "The ECMAScript specification",
"scripts": {
"ipr-check": "node scripts/check-form tc39/ecma262 HEAD --all",
"ipr-check": "node scripts/check-form tc39/ecma262",
"build-head": "npm run build-only -- --lint-spec --strict",
"prebuild-only": "npm run clean && mkdir out && cp -R img out",
"build-only": "ecmarkup --verbose spec.html --multipage out",
Expand Down
20 changes: 13 additions & 7 deletions scripts/check-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ if (!key) {

const sheetData = `https://sheets.googleapis.com/v4/spreadsheets/${sheetID}/values/Sheet1!A2:A?key=${key}`;

const [,, slug, branch, all] = process.argv;

if (!slug || !branch) {
throw 'args required: slug, branch';
const { values, positionals } = require('util').parseArgs({
allowPositionals: true,
strict: true,
});
if (positionals.length < 1 || positionals.length > 2) {
throw 'usage: node check-form.js <slug> [ref]';
}
if (typeof all !== 'undefined' && all !== '--all') {
throw '`all` arg, if provided, must be `--all`'
const [slug, ref = 'HEAD'] = positionals;

console.debug({ slug, ref });

if (!slug || !ref) {
throw 'args required: slug, ref';
}

const sha = String(execSync(`git rev-parse ${branch}`)).trim();
const sha = String(execSync(`git rev-parse ${ref}`)).trim();

const request = async (url, method = 'GET', postData) => {
// adapted from https://medium.com/@gevorggalstyan/how-to-promisify-node-js-http-https-requests-76a5a58ed90c
Expand Down

0 comments on commit 0b6c5f1

Please sign in to comment.