Skip to content

Commit 427ed27

Browse files
committed
fix: guard append-only base checks against empty string from workflow_dispatch
When workflow_dispatch falls back to full CI, github.event.pull_request.base.sha and github.event.before are both undefined, so the YAML ${{ ... || ... }} expression resolves to an empty string. The env vars are set to '' which passes the !== undefined guard, causing git cat-file to fail on the empty SHA. Add an explicit empty-string check so the append-only compatibility gates correctly skip when no base commit is available.
1 parent 6f6ccc4 commit 427ed27

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎scripts/error-codes/generate.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ async function main() {
352352
const check = process.argv.includes('--check');
353353
const catalog = validateCatalog(JSON.parse(readFileSync(catalogFile, 'utf8')));
354354
const compatibilityBase = process.env.OCTANE_ERROR_CODES_BASE;
355-
if (compatibilityBase !== undefined) {
355+
if (compatibilityBase !== undefined && compatibilityBase !== '') {
356356
try {
357357
execFileSync('git', ['cat-file', '-e', `${compatibilityBase}^{commit}`], {
358358
cwd: root,

‎scripts/redact-audit/generate.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (errors.length > 0) {
3939
}
4040

4141
const compatibilityBase = process.env.OCTANE_REDACT_AUDIT_BASE;
42-
if (compatibilityBase !== undefined) {
42+
if (compatibilityBase !== undefined && compatibilityBase !== '') {
4343
try {
4444
execFileSync('git', ['cat-file', '-e', `${compatibilityBase}^{commit}`], {
4545
cwd: REPO_ROOT,

0 commit comments

Comments
 (0)