Skip to content
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

Enhance link-checker workflow for pull request reporting #529

Merged

Conversation

guibranco
Copy link
Owner

@guibranco guibranco commented Sep 14, 2024

Description

  • Enhanced the link-checker workflow to comment on pull requests when issues are found.
  • Fixed a typo in the concurrency group name from links-cheker to links-checker.
  • Added permission for pull-requests to allow commenting.
  • Updated the logic to create issues only for non-pull request events.

Changes walkthrough 📝

Relevant files
Enhancement
link-checker.yml
Enhance link-checker workflow with pull request comments 

.github/workflows/link-checker.yml

  • Fixed typo in concurrency group name.
  • Added permission for pull requests.
  • Updated condition for creating issues based on event type.
  • Added step to comment on pull requests with link checker results.
  • +16/-2   

    Summary by CodeRabbit

    • New Features

      • Enhanced link-checking workflow to post comments directly on pull requests when link issues are detected, improving communication.
      • Added detailed feedback from the link checker report in comments on pull requests for better issue resolution.
    • Bug Fixes

      • Corrected the concurrency group name for better workflow identification.
      • Prevented unnecessary issue creation during pull request events, reducing clutter in the issue tracker.

    @guibranco guibranco linked an issue Sep 14, 2024 that may be closed by this pull request
    @gstraccini gstraccini bot added the ☑️ auto-merge Automatic merging of pull requests (gstraccini-bot) label Sep 14, 2024
    @penify-dev penify-dev bot added the enhancement A enhancement to the project label Sep 14, 2024
    @github-actions github-actions bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 14, 2024
    @gstraccini gstraccini bot added CI Continuous Integration / Pipeline Code Quality Code Quality :octocat: github-actions GitHub Actions for automation and CI/CD good first issue A issue for someone self assign and help me =D hacktoberfest Participation in the Hacktoberfest event help wanted Feel free to take this issue for you and help me! 🐛 bug Issues related to bugs or errors 🔗 link checker Link checker report labels Sep 14, 2024
    @penify-dev penify-dev bot changed the title Update link-checker.yml Enhance link-checker workflow for pull request reporting Sep 14, 2024
    Copy link

    coderabbitai bot commented Sep 14, 2024

    Warning

    Rate limit exceeded

    @guibranco has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 25 seconds before requesting another review.

    How to resolve this issue?

    After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

    We recommend that you space out your commits to avoid hitting the rate limit.

    How do rate limits work?

    CodeRabbit enforces hourly rate limits for each developer per organization.

    Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

    Please see our FAQ for further information.

    Commits

    Files that changed from the base of the PR and between 736cbb1 and 74df42d.

    Walkthrough

    The changes made in the pull request enhance the link-checking workflow within the GitHub Actions configuration. Key modifications include correcting the concurrency group name, expanding job permissions to allow writing on pull requests, and refining the logic for handling link-checking failures during pull request events. Instead of creating separate issues, the workflow now posts comments directly on the pull request when failures occur, improving communication and responsiveness.

    Changes

    File Change Summary
    .github/workflows/link-checker.yml - Corrected concurrency group name from links-cheker to links-checker
    - Added pull-requests: write permission in job permissions section
    - Modified issue creation condition to prevent issues on pull request events
    - Added step to read ./lychee/out.md when link checker fails during pull request events
    - Added step to comment on pull requests when link checker fails during pull request events

    Poem

    🐇 In the meadow where links do play,
    A checker hops to save the day.
    With comments bright on pull requests,
    No issues made, just helpful quests.
    Hooray for changes, clear and neat,
    A workflow now, oh so sweet! 🌼


    Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

    Share
    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>.
      • Generate unit testing code for this file.
      • 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. Examples:
      • @coderabbitai generate unit testing code for this file.
      • @coderabbitai modularize this function.
    • 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 generate interesting stats about this repository and render them as a table.
      • @coderabbitai show all the console.log statements in this repository.
      • @coderabbitai read src/utils.ts and generate unit testing code.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    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)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    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

    Documentation and Community

    • 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.

    Copy link
    Contributor

    penify-dev bot commented Sep 14, 2024

    PR Review 🔍

    ⏱️ Estimated effort to review [1-5]

    2, because the changes are straightforward and primarily involve workflow configuration with a few added steps.

    🧪 Relevant tests

    No

    ⚡ Possible issues

    No

    🔒 Security concerns

    No

    Copy link
    Contributor

    penify-dev bot commented Sep 14, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Maintainability
    Correct the spelling of the group name for clarity and consistency

    The group name in the concurrency section should be consistent and correctly spelled to
    avoid confusion and potential issues in job management.

    .github/workflows/link-checker.yml [13]

    +group: links-checker
     
    -
    Suggestion importance[1-10]: 8

    Why: The suggestion addresses a spelling mistake in the group name, which is important for clarity and consistency in job management.

    8
    Possible issue
    Refine the condition for issue creation to ensure it covers all necessary cases

    The condition for creating an issue should be reviewed to ensure it captures all relevant
    scenarios, including pull requests that may not have been checked.

    .github/workflows/link-checker.yml [59]

    -if: github.event_name != 'pull_request' && env.lychee_exit_code != 0
    +if: (github.event_name != 'pull_request' || github.event.action != 'opened') && env.lychee_exit_code != 0
     
    Suggestion importance[1-10]: 7

    Why: The suggestion improves the condition for issue creation, but the proposed change may not cover all scenarios, making it a good but not essential improvement.

    7
    Best practice
    Add error handling to the comment step to improve robustness

    Consider adding error handling or logging for the comment step to ensure that any failures
    are captured and can be debugged effectively.

    .github/workflows/link-checker.yml [71]

     - name: Comment on pull request
    +  continue-on-error: true
     
    Suggestion importance[1-10]: 6

    Why: Adding error handling is a good practice that enhances robustness, but it is not a critical change, hence the moderate score.

    6
    Security
    Adjust the permission level for pull requests to match the required access

    Ensure that the permissions for pull-requests are necessary and align with the intended
    functionality of the workflow.

    .github/workflows/link-checker.yml [23]

    -pull-requests: write
    +pull-requests: read
     
    Suggestion importance[1-10]: 5

    Why: While the suggestion raises a valid point about permissions, changing from 'write' to 'read' may not be appropriate depending on the intended functionality, making this suggestion less critical.

    5

    Copy link
    Contributor

    github-actions bot commented Sep 14, 2024

    🔗✅ Link checker found some issues in the pull request

    Summary

    Status Count
    🔍 Total 467
    ✅ Successful 364
    ⏳ Timeouts 0
    🔀 Redirected 0
    👻 Excluded 95
    ❓ Unknown 0
    🚫 Errors 8

    Errors per input

    Errors in ./data/bancos.md

    Errors in ./CHANGELOG.md

    Repository owner deleted a comment from github-actions bot Sep 14, 2024
    Copy link
    Contributor

    Summary

    Status Count
    🔍 Total 467
    ✅ Successful 364
    ⏳ Timeouts 0
    🔀 Redirected 0
    👻 Excluded 95
    ❓ Unknown 0
    🚫 Errors 8

    Errors per input

    Errors in ./data/bancos.md

    Errors in ./CHANGELOG.md

    Copy link

    sonarcloud bot commented Sep 14, 2024

    @guibranco guibranco merged commit 2d2d43d into main Sep 14, 2024
    31 of 32 checks passed
    @guibranco guibranco deleted the feature/523-feature-link-checker-report-on-pull-request branch September 14, 2024 02:59
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    ☑️ auto-merge Automatic merging of pull requests (gstraccini-bot) 🐛 bug Issues related to bugs or errors CI Continuous Integration / Pipeline Code Quality Code Quality enhancement A enhancement to the project good first issue A issue for someone self assign and help me =D hacktoberfest Participation in the Hacktoberfest event help wanted Feel free to take this issue for you and help me! 🔗 link checker Link checker report :octocat: github-actions GitHub Actions for automation and CI/CD Review effort [1-5]: 2 size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    [FEATURE] Link checker report on pull request
    1 participant