-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ci): robust SHA sync in bump-self-sha + final fixes #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -98,18 +98,25 @@ | |||||||||||||||||||||
| perl -pi -e "s|\Q${old_sha}\E|${new_sha}|g" "$MANIFEST" | ||||||||||||||||||||||
| info "Updated manifest.yml" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # ── 5. Update all workflow files that reference the old SHA ────────────────── | ||||||||||||||||||||||
| # ── 5. Update all YiAgent/OpenCI SHA references ────────────────────────────── | ||||||||||||||||||||||
| # Instead of searching only for the manifest.yml SHA (which can diverge from | ||||||||||||||||||||||
| # workflow files), replace ANY YiAgent/OpenCI@<40-char-hex> reference with | ||||||||||||||||||||||
| # the new SHA. This works even when workflow files have a different old SHA | ||||||||||||||||||||||
| # than manifest.yml (e.g., after a revert-workflow-files cycle). | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| updated=0 | ||||||||||||||||||||||
| while IFS= read -r -d '' f; do | ||||||||||||||||||||||
| if grep -q "$old_sha" "$f" 2>/dev/null; then | ||||||||||||||||||||||
| perl -pi -e "s|\Q${old_sha}\E|${new_sha}|g" "$f" | ||||||||||||||||||||||
| # Compare checksums to detect if perl actually changed the file. | ||||||||||||||||||||||
| before=$(shasum -a 256 "$f" 2>/dev/null || true) | ||||||||||||||||||||||
| perl -pi -e "s|(YiAgent/OpenCI/[^\s@]+)\@[a-f0-9]{40}|\1\@${new_sha}|g" "$f" | ||||||||||||||||||||||
| after=$(shasum -a 256 "$f" 2>/dev/null || true) | ||||||||||||||||||||||
| if [ "$before" != "$after" ]; then | ||||||||||||||||||||||
|
Check failure on line 113 in scripts/bump-self-sha.sh
|
||||||||||||||||||||||
| info "Updated $f" | ||||||||||||||||||||||
| updated=$((updated + 1)) | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
| done < <(find "$REPO_ROOT/.github/workflows" "$REPO_ROOT/actions" \ | ||||||||||||||||||||||
| -name "*.yml" -o -name "*.yaml" 2>/dev/null | tr '\n' '\0') | ||||||||||||||||||||||
|
Comment on lines
117
to
118
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Two compounding robustness concerns: (1)
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||
| echo "Done. Updated manifest.yml + $updated workflow file(s) to $new_sha" | ||||||||||||||||||||||
| echo "Done. Updated manifest.yml + $updated workflow/action file(s) to $new_sha" | ||||||||||||||||||||||
| echo "Stage and commit: git add manifest.yml .github/workflows actions/ && git commit -m 'chore(manifest): bump YiAgent/OpenCI SHA to $new_sha'" | ||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\1in the replacement side ofs///is deprecated in Perl — it is documented as equivalent to$1today, but perlop explicitly warns that the behaviour may change in future versions. The idiomatic form is$1, which carries no deprecation risk and makes the intent unambiguous to readers unfamiliar with the edge-case rule that\Nin a replacement string is treated as a back-reference rather than an octal escape.