Fix pr_comments output being empty when pr-comments input is disabled #133
+20
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
steps.commit-check.outputs.pr_comments
output was empty when thepr-comments
input was set tofalse
(which is the default). This prevented users from accessing the formatted commit check results in their workflows, even when they only wanted the output data without posting actual PR comments.Root Cause
The
pr_comments
output was only being set inside theadd_pr_comments()
function, which returns early whenPR_COMMENTS == "false"
. This meant the output was never written to$GITHUB_OUTPUT
when PR comments were disabled.Solution
set_pr_comments_output()
function that always sets thepr_comments
output regardless of thepr-comments
input settingmain()
function to callset_pr_comments_output()
after all other operationsadd_pr_comments()
to avoid duplication and maintain single responsibilityResult
Now
steps.commit-check.outputs.pr_comments
is always available and contains the properly formatted commit check results:This change maintains backward compatibility while fixing the missing output issue. Users can now access commit check results programmatically regardless of their PR commenting preferences.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.