Skip to content

fix(ci): fail release upload step on any non-2xx GitHub API response#474

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/sileht/browser-extension-ci-422/fail-release-upload-step-non-2xx-github-api-resp--a4cd0d86
May 21, 2026
Merged

fix(ci): fail release upload step on any non-2xx GitHub API response#474
mergify[bot] merged 1 commit into
mainfrom
devs/sileht/browser-extension-ci-422/fail-release-upload-step-non-2xx-github-api-resp--a4cd0d86

Conversation

@sileht
Copy link
Copy Markdown
Member

@sileht sileht commented May 20, 2026

The "Upload to GitHub release assets" step ran curl --fail under
set +e, then only treated exit code 22 as a failure
(if [ $? = 22 ]). When GitHub returned 422, curl actually exited with
56 ("Failure in receiving network data" - curl aborts the HTTP/2
transfer mid-stream when --fail trips), so the = 22 check never
matched. With errexit disabled the loop finished and the step exited 0,
turning a rejected upload green.

Drop the exit-code guessing: run curl in an if ! so any non-zero exit
(22, 56, network errors) triggers exit 1, and use --fail-with-body
so GitHub's error payload (the 422 detail) stays visible in the logs.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

The "Upload to GitHub release assets" step ran `curl --fail` under
`set +e`, then only treated exit code 22 as a failure
(`if [ $? = 22 ]`). When GitHub returned 422, curl actually exited with
56 ("Failure in receiving network data" - curl aborts the HTTP/2
transfer mid-stream when `--fail` trips), so the `= 22` check never
matched. With errexit disabled the loop finished and the step exited 0,
turning a rejected upload green.

Drop the exit-code guessing: run curl in an `if !` so any non-zero exit
(22, 56, network errors) triggers `exit 1`, and use `--fail-with-body`
so GitHub's error payload (the 422 detail) stays visible in the logs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Change-Id: Ia4cd0d86e9292735e26dffd2afacad1b6511ccd3
Copilot AI review requested due to automatic review settings May 20, 2026 09:11
@mergify mergify Bot deployed to Mergify Merge Protections May 20, 2026 09:11 Active
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 20, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Required Reviews

Wonderful, this rule succeeded.
  • any of:
    • #approved-reviews-by >= 2
    • author = dependabot[bot]

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:

🟢 🔎 Reviews

Wonderful, this rule succeeded.
  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

Copy link
Copy Markdown

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

Improves the release workflow’s reliability by ensuring the “Upload to GitHub release assets” step fails whenever the GitHub API upload request fails, instead of only failing for a specific curl exit code.

Changes:

  • Enable strict shell execution (set -euo pipefail) for the upload step.
  • Wrap curl in if ! ...; then so any non-zero exit code fails the job.
  • Switch to --fail-with-body so GitHub’s error payload (e.g., 422 details) remains visible in logs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sileht sileht marked this pull request as ready for review May 20, 2026 09:13
@mergify mergify Bot requested a review from a team May 20, 2026 09:13
@sileht sileht requested a review from a team May 21, 2026 08:23
@mergify mergify Bot added the queued label May 21, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 21, 2026

Merge Queue Status

This pull request spent 2 minutes 44 seconds in the queue, including 2 minutes 7 seconds running CI.

Required conditions to merge

mergify Bot added a commit that referenced this pull request May 21, 2026
@mergify mergify Bot merged commit 40c19f5 into main May 21, 2026
8 checks passed
@mergify mergify Bot deleted the devs/sileht/browser-extension-ci-422/fail-release-upload-step-non-2xx-github-api-resp--a4cd0d86 branch May 21, 2026 08:28
@mergify mergify Bot removed the queued label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants