Add accurate context when run rerun fails by leudz · Pull Request #10774 · cli/cli · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Add accurate context when run rerun fails #10774

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

Merged
merged 4 commits into from
Jun 11, 2025
Merged

Add accurate context when run rerun fails #10774

merged 4 commits into from
Jun 11, 2025

Conversation

leudz
Copy link
Contributor

@leudz leudz commented Apr 12, 2025

This is a small change to provide users the context received by the API when gh run rerun fails.

Before it was hardcoded to "its workflow file may be broken" for all 403 errors.
As @williammartin pointed out, it recently changed for workflow runs older than a month old but not for other errors. b41b771

Before:

gh run rerun -R leudz/test --failed 14414132832
run 14414132832 cannot be rerun; its workflow file may be broken

After:

gh run rerun -R leudz/test --failed 14414132832
run 14414132832 cannot be rerun; This workflow is already running

Fixes #9221

@leudz leudz requested a review from a team as a code owner April 12, 2025 00:46
@leudz leudz requested a review from babakks April 12, 2025 00:46
@leudz leudz temporarily deployed to cli-automation April 12, 2025 00:46 — with GitHub Actions Inactive
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Apr 12, 2025
@williammartin williammartin requested a review from Copilot April 15, 2025 15:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the error handling for rerun failures to provide users with the actual API response rather than a hardcoded message.

  • Updates error message formatting when a 403 error is encountered during a run rerun
  • Removes a conditional check for a specific error message to always relay the API's error message
Comments suppressed due to low confidence (1)

pkg/cmd/run/rerun/rerun.go:204

  • [nitpick] The updated error handling now directly uses the API's error message for 403 errors. Please ensure that these messages are consistently clear and user-friendly without inadvertently exposing internal details.
if errors.As(err, &httpError) && httpError.StatusCode == 403 {

Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for fixing this! 🙏

The CI is failing due to old error messages in the tests.

I'm going to push a commit to fix the tests and improve the coverage. So, I'm approving this.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
@babakks babakks requested a review from williammartin April 16, 2025 10:14
@babakks
Copy link
Member

babakks commented Apr 16, 2025

@williammartin Since I'm touching this PR, a fresh pair of eyes is needed for review.

babakks added 2 commits May 15, 2025 11:09
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
@babakks
Copy link
Member

babakks commented May 15, 2025

@leudz I just pushed a quick commit to use the newly added httpmock.JSONErrorResponse helper function.

@babakks babakks merged commit 1eee56e into cli:trunk Jun 11, 2025
9 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jun 19, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cli/cli](https://github.com/cli/cli) | patch | `v2.74.1` -> `v2.74.2` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>cli/cli (cli/cli)</summary>

### [`v2.74.2`](https://github.com/cli/cli/releases/tag/v2.74.2): GitHub CLI 2.74.2

[Compare Source](cli/cli@v2.74.1...v2.74.2)

#### What's Changed

##### 🐛 Fixes

- Fix assignees being dropped from `gh pr edit` by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#11065
- Add accurate context when run rerun fails by [@&#8203;leudz](https://github.com/leudz) in cli/cli#10774
- Avoid requesting MR reviewer twice by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#11099
- Quote filenames suggested at the end of worklow run by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#11134
- Fix expected error output of TestRepo/repo-rename-transfer-ownership by [@&#8203;aconsuegra](https://github.com/aconsuegra) in cli/cli#10888

##### 📚 Docs & Chores

- Add instructions for MidnightBSD installation by [@&#8203;laffer1](https://github.com/laffer1) in cli/cli#10699
- docs: update install command for Debian by [@&#8203;MagneticNeedle](https://github.com/MagneticNeedle) in cli/cli#10935
- Fix step order for CodeQL workflow by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#11145
- Add workflow to check `help wanted` labelling by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#11105
- Quote workflow conditional by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#11122
- Fix script path for help-wanted check by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#11125
- Exclude 3rd party license compliance content from GHAS scanning by [@&#8203;andyfeller](https://github.com/andyfeller) in cli/cli#11127
- Second fix for file not found in help-wanted check by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#11128
- Ensure gh executes in workflow check script by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#11133
- Improve help wanted check skipping logic by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#11135

##### :dependabot: Dependencies

- Bump go to 1.24 by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#11142
- chore(deps): bump mislav/bump-homebrew-formula-action from 3.2 to 3.4 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#11066
- chore(deps): bump github.com/sigstore/protobuf-specs from 0.4.2 to 0.4.3 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#11092
- chore(deps): bump google.golang.org/grpc from 1.72.0 to 1.72.2 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#11033
- chore(deps): bump actions/attest-build-provenance from 2.3.0 to 2.4.0 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#11107
- chore(deps): bump github.com/in-toto/attestation from 1.1.1 to 1.1.2 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#11123
- chore(deps): bump github.com/google/go-containerregistry from 0.20.3 to 0.20.6 by [@&#8203;dependabot](https://github.com/dependabot) in cli/cli#11120
- Bump golangci-lint to v2 by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#11121

#### New Contributors

- [@&#8203;MagneticNeedle](https://github.com/MagneticNeedle) made their first contribution in cli/cli#10935
- [@&#8203;laffer1](https://github.com/laffer1) made their first contribution in cli/cli#10699

**Full Changelog**: cli/cli@v2.74.1...v2.74.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC42MC4xIiwidXBkYXRlZEluVmVyIjoiNDAuNjAuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external pull request originating outside of the CLI core team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gh run rerun --failed fails with "its workflow file may be broken" when workflow not finished yet
3 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.