Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 19, 2025

Problem

The steps.commit-check.outputs.pr_comments output was empty when the pr-comments input was set to false (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.

# This would result in empty pr_comments output
- uses: commit-check/commit-check-action@v1
  id: commit-check
  with:
    pr-comments: false  # default value

# This would fail because pr_comments is empty
- name: Save results
  run: echo "${{ steps.commit-check.outputs.pr_comments }}" > pr-comments.txt

Root Cause

The pr_comments output was only being set inside the add_pr_comments() function, which returns early when PR_COMMENTS == "false". This meant the output was never written to $GITHUB_OUTPUT when PR comments were disabled.

Solution

  • Created new set_pr_comments_output() function that always sets the pr_comments output regardless of the pr-comments input setting
  • Modified main() function to call set_pr_comments_output() after all other operations
  • Removed output setting from add_pr_comments() to avoid duplication and maintain single responsibility

Result

Now steps.commit-check.outputs.pr_comments is always available and contains the properly formatted commit check results:

- uses: commit-check/commit-check-action@v1
  id: commit-check
  with:
    pr-comments: false  # PR comments disabled

# This now works reliably
- name: Save results  
  run: echo "${{ steps.commit-check.outputs.pr_comments }}" > pr-comments.txt

# Output format examples:
# Success: "# Commit-Check ✔️"
# Failure: "# Commit-Check ❌\n```\nError details here\n```"

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.

Copilot AI and others added 2 commits August 19, 2025 21:28
…ting

Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
@shenxianpeng shenxianpeng marked this pull request as ready for review August 19, 2025 21:30
@shenxianpeng shenxianpeng requested a review from a team as a code owner August 19, 2025 21:30
@shenxianpeng shenxianpeng requested review from shenxianpeng and removed request for a team August 19, 2025 21:30
Copy link

coderabbitai bot commented Aug 19, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Join our Discord community for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@shenxianpeng shenxianpeng merged commit af84ea1 into bugfix/fork-repo-add-comment Aug 19, 2025
1 of 2 checks passed
@shenxianpeng shenxianpeng deleted the copilot/fix-8c0c2e65-6c98-4a61-a2b2-5cdfea19996c branch August 19, 2025 21:30
@Copilot Copilot AI restored the copilot/fix-8c0c2e65-6c98-4a61-a2b2-5cdfea19996c branch August 19, 2025 21:31
@Copilot Copilot AI changed the title [WIP] echo "" > pr-comments.txt why? steps.commit-check.outputs.pr_comments is empty. Help me fix it! Fix pr_comments output being empty when pr-comments input is disabled Aug 19, 2025
Copilot finished work on behalf of shenxianpeng August 19, 2025 21:31
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.

2 participants