Skip to content

Commit 8b5552e

Browse files
committed
Add fallback for running locally
1 parent 6c908cf commit 8b5552e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

scripts/check_changeset.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import fs from 'mz/fs';
2525
const root = resolve(__dirname, '..');
2626
const git = simpleGit(root);
2727

28+
const baseRef = process.env.GITHUB_PULL_REQUEST_BASE_SHA || 'master';
29+
const headRef = process.env.GITHUB_PULL_REQUEST_HEAD_SHA || 'HEAD';
30+
2831
// Version bump text converted to rankable numbers.
2932
const bumpRank: Record<string, number> = {
3033
'patch': 0,
@@ -65,10 +68,7 @@ async function getDiffData(): Promise<{
6568
changedPackages: Set<string>;
6669
changesetFile: string;
6770
} | null> {
68-
const diff = await git.diff([
69-
'--name-only',
70-
`${process.env.GITHUB_PULL_REQUEST_BASE_SHA}...${process.env.GITHUB_PULL_REQUEST_HEAD_SHA}`
71-
]);
71+
const diff = await git.diff(['--name-only', `${baseRef}...${headRef}`]);
7272
const changedFiles = diff.split('\n');
7373
let changesetFile = '';
7474
const changedPackages = new Set<string>();
@@ -123,9 +123,7 @@ async function parseChangesetFile(changesetFile: string) {
123123
async function main() {
124124
const errors = [];
125125
try {
126-
await exec(
127-
`yarn changeset status --since ${process.env.GITHUB_PULL_REQUEST_BASE_SHA}`
128-
);
126+
await exec(`yarn changeset status --since ${baseRef}`);
129127
console.log(`::set-output name=BLOCKING_FAILURE::false`);
130128
} catch (e) {
131129
if (e.message.match('No changesets present')) {

0 commit comments

Comments
 (0)