Skip to content

fix: Guard GITHUB_OUTPUT, surface GraphQL errors and tighten is-int - #172

Merged
hustcer merged 1 commit into
mainfrom
hotfix
Aug 21, 2026
Merged

fix: Guard GITHUB_OUTPUT, surface GraphQL errors and tighten is-int#172
hustcer merged 1 commit into
mainfrom
hotfix

Conversation

@hustcer

@hustcer hustcer commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Fix several issues that only show up outside of Github Actions or on error paths:

  • Guard $env.GITHUB_OUTPUT behind a set-action-output helper, so that create/close no longer fail with a column-not-found error when run locally via just or during manual debugging
  • Add check-graphql-errors in query.nu and use it in both query-issue-status (which previously did no error checking at all) and query-pr-closing-issues (which discarded the error payload); the real diagnostics are now printed and the first message is carried in error make
  • Drop the redundant --remove-milestone calls on the --force path: the REST PATCH is already overwrite semantics, and the extra call created a visible intermediate state plus a duplicated "will be ignored" message
  • Make is-int match ASCII digits only, since \d in Rust regex covers the whole Unicode Nd category and accepted input like '123' as a milestone number
  • Import has-ref from common.nu in release.nu instead of relying on the Justfile overlay
  • Replace the long-removed register -e json with plugin add in _setup

closes #171

Summary by CodeRabbit

  • Bug Fixes

    • Improved milestone replacement behavior when force-updating issues and pull requests.
    • Added clearer GraphQL error reporting for issue and pull request operations.
    • Improved validation of milestone numbers to reject invalid characters.
    • Made GitHub Actions output handling safer when workflow output is unavailable.
  • Compatibility

    • Updated setup support for Nushell v0.93.
    • Improved release workflow reliability.

Fix several issues that only show up outside of Github Actions or on error paths:

- Guard `$env.GITHUB_OUTPUT` behind a `set-action-output` helper, so that
  `create`/`close` no longer fail with a column-not-found error when run
  locally via `just` or during manual debugging
- Add `check-graphql-errors` in `query.nu` and use it in both
  `query-issue-status` (which previously did no error checking at all) and
  `query-pr-closing-issues` (which discarded the error payload); the real
  diagnostics are now printed and the first message is carried in `error make`
- Drop the redundant `--remove-milestone` calls on the `--force` path: the REST
  PATCH is already overwrite semantics, and the extra call created a visible
  intermediate state plus a duplicated "will be ignored" message
- Make `is-int` match ASCII digits only, since `\d` in Rust regex covers the
  whole Unicode Nd category and accepted input like '123' as a milestone number
- Import `has-ref` from `common.nu` in `release.nu` instead of relying on the
  Justfile overlay
- Replace the long-removed `register -e json` with `plugin add` in `_setup`
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 91c802d5-97ae-4d05-8f9b-8cb4b5c662fa

📥 Commits

Reviewing files that changed from the base of the PR and between b57a2e2 and 67a0f47.

📒 Files selected for processing (4)
  • Justfile
  • nu/milestone.nu
  • nu/query.nu
  • nu/release.nu

Included review availability: Your plan provides up to 5 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The pull request updates Nushell setup compatibility, milestone mutation behavior, GitHub Actions output handling, integer validation, GraphQL error reporting, and release-script imports.

Changes

Nushell workflow updates

Layer / File(s) Summary
Shared GraphQL error validation
nu/query.nu
A shared helper reports GraphQL diagnostics and raises the first error message. Issue-status and pull-request queries use the helper before reading results.
Milestone updates and action outputs
nu/milestone.nu
Forced updates rely on replacement PATCH operations. Milestone outputs use guarded writes, and integer validation accepts only ASCII digits.
Nushell setup and release wiring
Justfile, nu/release.nu
The setup recipe uses plugin add. The release script imports has-ref from common.nu.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 67a0f

The PR makes localized error-handling, environment-compatibility, command cleanup, input-validation, and setup changes; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fixes: guarding GITHUB_OUTPUT, surfacing GraphQL errors, and tightening integer validation.
Linked Issues check ✅ Passed The changes implement all stated objectives for issue #171, including output guarding, GraphQL diagnostics, milestone handling, ASCII validation, imports, and plugin setup.
Out of Scope Changes check ✅ Passed All changed files and updates directly support the objectives described in issue #171 and the pull request summary.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hotfix

Comment @coderabbitai help to get the list of available commands.

@hustcer
hustcer merged commit f8cedae into main Aug 21, 2026
2 of 3 checks passed
@hustcer
hustcer deleted the hotfix branch August 21, 2026 02:49
@github-actions github-actions Bot added this to the v3.2 milestone Aug 21, 2026
hustcer added a commit that referenced this pull request Aug 21, 2026
)

* fix: Send milestone fields as raw strings and harden action inputs

Follow-up to the #168/#170/#172/#174 review. `create` could not produce a
purely numeric title, `force: yes` aborted with a raw Nushell error, and
several paths only reachable outside Actions failed with type errors.

- milestone.nu: use `gh api -f` (raw-field) instead of `-F` for `title`,
  `description`, `due_on` and `state`; `-F` applies magic type conversion,
  so `title: '20260821'` was sent as a JSON number and rejected with
  `422 ... 20260821 is not a string`
- common.nu: add `parse-bool`, accepting true/yes/on/1 and false/no/off/0
  and falling back to each input's documented default when empty; replaces
  the `into bool` call that aborted on `force: yes`
- milestone.nu: extract `resolve-milestone-id`, replacing the two verbatim
  lookup blocks in `close-milestone`/`delete-milestone`, and report an
  empty or unmatched milestone with `INVALID_PARAMETER`
- milestone.nu: default `--milestone` to `''` so `close`/`delete` without
  it report a message instead of `can't convert nothing to string`
- milestone.nu: add `resolve-gh-token`, falling back to the gh CLI's own
  credential so `just dr` / `just di` work without an exported GH_TOKEN
- milestone.nu: exit with `INVALID_PARAMETER` on an unknown action, and
  drop the `-d` short flag from `--dry-run`, which means `--due-on` on
  `milestone-action`
- milestone.nu: move the "PATCH overwrites" comment below the no-milestone
  guard, where it is actually true, and say so when `--force` has no
  replacement to apply rather than doing nothing silently
- query.nu: give `check-graphql-errors` typed pipeline input
- ci.yml: cover numeric titles and closing an already-closed milestone;
  compute the due date in bash so the second Nu version pin is gone
- create/close/delete.yml: run `uses: ./` behind a checkout, so a dispatch
  exercises the branch it came from instead of `@develop`
- Document that an all-digit `milestone` is always read as a number

* docs: Scope the all-digit milestone rule to close and delete

The note added in ca12e6c stated the rule unconditionally, but it only
holds for `close`/`delete`, which route an all-digit `milestone` through
`resolve-milestone-id`. `bind-pr`/`bind-issue` pass the value straight to
`get-milestone-number`, which matches on `title`, so there an all-digit
value is a title - as the README input table already said.

- action.yaml: state the rule per action instead of for the input as a whole
- README/README.zh-CN: note that bind matches by title only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guard GITHUB_OUTPUT, surface GraphQL errors and tighten is-int

1 participant