Detail errors for workflows - #992
Conversation
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
WalkthroughThe release workflow's Changes
Sequence Diagram(s)sequenceDiagram
participant Workflow
participant GitHubAPI
Workflow->>GitHubAPI: Check if branch exists (getBranch)
alt Branch exists
Workflow->>GitHubAPI: Update branch ref to tag commit (updateRef, force)
else Branch does not exist (404)
Workflow->>GitHubAPI: Create branch at tag commit (createRef)
else Other error
Workflow->>Workflow: Log error and mark step failed
Workflow->>GitHubAPI: Rethrow error
end
Possibly related PRs
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/pull-requests-release.yaml (1)
108-108: Remove trailing whitespace
Line 108 has trailing spaces which trigger YAML lint errors. Please delete the extra spaces at the end of this line.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 108-108: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/pull-requests-release.yaml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/pull-requests-release.yaml
[error] 108-108: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build and Test
🔇 Additional comments (3)
.github/workflows/pull-requests-release.yaml (3)
103-108: Branch existence check is well-handled
Thegithub.rest.repos.getBranchcall correctly determines if the maintenance branch exists before proceeding. This aligns with the intended control flow for conditional create/update.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 108-108: trailing spaces
(trailing-spaces)
109-116: Force-update of branch reference is correctly implemented
Usinggithub.rest.git.updateRefwithforce: trueensures the existing branch is pointed to the exact tag commit. This matches the goal of keeping the maintenance branch in sync.
118-126: Branch creation fallback is handled as expected
Catching a 404 and invokinggithub.rest.git.createRefensures new release branches are created automatically when missing. This satisfies the “ensure branch exists” objective.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/pull-requests-release.yaml (2)
108-108: Remove trailing whitespace.
YAMLlint reports trailing spaces on this line, which can cause lint failures. Please remove any extra spaces.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 108-108: trailing spaces
(trailing-spaces)
90-93: Optional: Destructureownerandrepo.
To reduce repetition and improve readability, consider adding this near the top of the script:+ const { owner, repo } = context.repo;Then use
ownerandrepoin the REST calls instead ofcontext.repo.owner/context.repo.repo.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/pull-requests-release.yaml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/pull-requests-release.yaml
[error] 108-108: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build and Test
🔇 Additional comments (3)
.github/workflows/pull-requests-release.yaml (3)
109-115: Correctly use short ref format for updateRef.
TheupdateRefendpoint expects therefparameter in the formheads/<branch>, notrefs/heads/<branch>. This change aligns with the GitHub REST API spec and prevents invalid reference errors.
118-125: Handle missing branch by creating it.
The catch block now explicitly checks for a 404 error and callscreateRefwithrefs/heads/<branch>, correctly creating the branch when it doesn't exist. This improves clarity and reliability of the maintenance branch flow.
126-130: Fail the workflow on unexpected errors.
On non-404 errors, the code now invokescore.setFailed()and rethrows the error, ensuring the workflow fails instead of continuing silently—addressing potential silent failure cases.
Summary by CodeRabbit