Skip to content

Commit 959968a

Browse files
rdimitrovclaude
andcommitted
Address Copilot review feedback on PR #748
- Switch upstream-release scripts and the inline node snippet in the workflow from `js-yaml` to the already-declared `yaml` package, so the workflow does not rely on a transitive dependency that could disappear in a future install. Rewrites the `.load()` calls to `.parse()` to match the new package's API. - Filter out null author logins in the `gh api compare` reviewers extraction (`.commits[].author.login? // empty`) so a commit with an unlinked GitHub user cannot pass an empty value into --add-reviewer. - Replace the nested `$([ ... ] && ... || ...)` has_gaps expression with an explicit `if/else` block so the quoting stays obviously correct and resists accidental breakage in future edits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 13ac7c5 commit 959968a

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

.github/workflows/upstream-release-docs.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ jobs:
270270
# Capture stderr separately so we can surface a missing-compare
271271
# situation in the PR body rather than silently dropping reviewers.
272272
if COMPARE=$(gh api "repos/$REPO/compare/$PREV...$NEW" \
273-
--jq '[.commits[].author.login] | unique | .[]' 2>/dev/null); then
273+
--jq '[.commits[].author.login? // empty] | unique | .[]' 2>/dev/null); then
274274
REVIEWERS=$(echo "$COMPARE" |
275275
grep -Ev '(\[bot\]$|^github-actions|^stacklokbot$|^dependabot|^renovate|^copilot)' |
276276
head -5 | paste -sd, -)
@@ -288,9 +288,9 @@ jobs:
288288
PROJECT_ID: ${{ steps.detect.outputs.id }}
289289
run: |
290290
HINTS=$(node -e "
291-
const yaml = require('js-yaml');
291+
const yaml = require('yaml');
292292
const fs = require('fs');
293-
const p = yaml.load(fs.readFileSync('.github/upstream-projects.yaml','utf8')).projects.find(x=>x.id===process.env.PROJECT_ID);
293+
const p = yaml.parse(fs.readFileSync('.github/upstream-projects.yaml','utf8')).projects.find(x=>x.id===process.env.PROJECT_ID);
294294
console.log(JSON.stringify(p?.docs_paths ?? []));
295295
")
296296
echo "docs_paths=$HINTS" >> "$GITHUB_OUTPUT"
@@ -388,7 +388,11 @@ jobs:
388388
fi
389389
echo "GAPS_EOF"
390390
391-
echo "has_gaps=$([ -n "$GAPS_BODY" ] && echo true || echo false)"
391+
if [ -n "$GAPS_BODY" ]; then
392+
echo "has_gaps=true"
393+
else
394+
echo "has_gaps=false"
395+
fi
392396
} >> "$GITHUB_OUTPUT"
393397
394398
- name: Apply pin_files substitutions

scripts/upstream-release/apply-pin-files.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// so unrelated `@latest` strings elsewhere in the file are safe.
1616

1717
import fs from 'node:fs';
18-
import yaml from 'js-yaml';
18+
import yaml from 'yaml';
1919

2020
const PROJECTS_FILE = '.github/upstream-projects.yaml';
2121

@@ -66,7 +66,7 @@ function main() {
6666
process.exit(1);
6767
}
6868

69-
const parsed = yaml.load(fs.readFileSync(PROJECTS_FILE, 'utf8'));
69+
const parsed = yaml.parse(fs.readFileSync(PROJECTS_FILE, 'utf8'));
7070
const project = parsed.projects.find((p) => p.id === id);
7171
if (!project) {
7272
console.error(`Unknown project id: ${id}`);

scripts/upstream-release/bump-yaml.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// matches (no-op — caller should not open a PR).
1818

1919
import fs from 'node:fs';
20-
import yaml from 'js-yaml';
20+
import yaml from 'yaml';
2121

2222
const PROJECTS_FILE = '.github/upstream-projects.yaml';
2323

@@ -69,7 +69,7 @@ function main() {
6969
}
7070

7171
const raw = fs.readFileSync(PROJECTS_FILE, 'utf8');
72-
const parsed = yaml.load(raw);
72+
const parsed = yaml.parse(raw);
7373
if (!parsed.projects.find((p) => p.id === id)) {
7474
console.error(`Unknown project id: ${id}`);
7575
process.exit(1);

scripts/upstream-release/detect-change.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import { execFileSync } from 'node:child_process';
2424
import fs from 'node:fs';
25-
import yaml from 'js-yaml';
25+
import yaml from 'yaml';
2626

2727
const PROJECTS_FILE = '.github/upstream-projects.yaml';
2828
const REPO_SHAPE = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
@@ -41,13 +41,13 @@ function loadFromRef(ref) {
4141
const text = execFileSync('git', ['show', `${ref}:${PROJECTS_FILE}`], {
4242
encoding: 'utf8',
4343
});
44-
return yaml.load(text).projects;
44+
return yaml.parse(text).projects;
4545
}
4646

4747
function main() {
4848
const ref = process.env.BASE_REF || 'origin/main';
4949
const mainProjects = loadFromRef(ref);
50-
const headProjects = yaml.load(
50+
const headProjects = yaml.parse(
5151
fs.readFileSync(PROJECTS_FILE, 'utf8')
5252
).projects;
5353

0 commit comments

Comments
 (0)