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

update pull-request.yml to ignore github actions when label "ignore-protected-files-pr" is added #2626

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

govindsingh3477
Copy link

@govindsingh3477 govindsingh3477 commented Oct 29, 2024

What kind of change does this PR introduce?

feature

Issue Number:

Fixes #2617

Did you add tests for your changes?

Snapshots/Videos:

If relevant, did you update the documentation?

Summary
There are cases where community members need to edit sensitive files. When this is done, the Check-Sensitive-Files test fails. The formal GitHub contributors can only merge PRs where all tests pass. This means the Repository owners have to merge the PRs. This creates a bottleneck in PR reviews. updated pull-request.yml file for GitHub action to be ignored if this label is applied to the PR by any of our GitHub contributors

Does this PR introduce a breaking change?

No

Other information

Have you read the contributing guide?

YEs

Summary by CodeRabbit

  • Chores
    • Updated the GitHub Actions workflow to refine the criteria for unauthorized file change checks.
    • Improved comments and formatting for better clarity.

Copy link

coderabbitai bot commented Oct 29, 2024

Walkthrough

The changes in this pull request modify the GitHub Actions workflow in the pull-request.yml file, specifically updating the Check-Sensitive-Files job. The new conditional logic includes a check for the presence of the ignore-sensitive-files-pr label, preventing the job from executing if the label is present. This adjustment refines the criteria for detecting unauthorized changes while maintaining the overall structure and functionality of the workflow.

Changes

File Change Summary
.github/workflows/pull-request.yml Updated the conditional check in the Check-Sensitive-Files job to include the ignore-sensitive-files-pr label. Minor adjustments in comments and formatting.

Assessment against linked issues

Objective Addressed Explanation
Implement logic for the ignore-sensitive-files-pr label in GitHub Actions (2617)

🐰 In the garden of code, I hop with glee,
A label of magic, now sets changes free!
With checks refined, we dance and play,
Ignoring the files, come what may!
Hooray for the workflow, so clever and bright,
In the land of PRs, everything's right! 🌼✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 819e73a and e62ff38.

📒 Files selected for processing (1)
  • .github/workflows/pull-request.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pull-request.yml

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>, please review it.
    • 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 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 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.

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

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
.github/workflows/pull-request.yml (1)

94-94: Consider documenting the label usage.

Since this introduces a new way to bypass protected file checks, consider adding documentation about:

  • When to use this label
  • Who can apply it
  • Which files are considered protected

Add a comment above the condition explaining the bypass mechanism:

+    # Skip check for dependabot PRs and PRs with 'ignore-protected-files-pr' label
+    # This label should only be applied by maintainers for authorized changes to protected files
     if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-protected-files-pr') }}

Also, consider updating the repository's contributing guidelines to document this process.

🛑 Comments failed to post (0)

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 29, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 29, 2024
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.44%. Comparing base (42024f6) to head (e62ff38).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2626   +/-   ##
========================================
  Coverage    98.44%   98.44%           
========================================
  Files          342      342           
  Lines        16734    16734           
  Branches      2408     2408           
========================================
  Hits         16473    16473           
  Misses         258      258           
  Partials         3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@varshith257 varshith257 added the ignore-sensitive-files-pr The contributor has a legitimate reason for editiing protected files label Oct 29, 2024
@palisadoes
Copy link
Contributor

@govindsingh3477

  • This is failing when the label is applied. I reran all the checks to test.

@palisadoes
Copy link
Contributor

Please work with @varshith257 to figure out a solution

.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
@varshith257
Copy link
Member

@palisadoes I think this is done!

@palisadoes
Copy link
Contributor

@varshith257 Are you able to merge this?

@varshith257
Copy link
Member

@palisadoes No

image

@palisadoes
Copy link
Contributor

Please refresh the screen to verify

@varshith257
Copy link
Member

varshith257 commented Oct 29, 2024

@palisadoes I think permissions aren't sufficient to merge
It seems there are rulesets to branch

@palisadoes
Copy link
Contributor

Ask one of the other members to approve to check for sure.

@palisadoes
Copy link
Contributor

The develop branches require two approvals.

@noman2002 noman2002 merged commit e59b02f into PalisadoesFoundation:develop Oct 29, 2024
11 checks passed
@varshith257
Copy link
Member

@palisadoes Maybe due to the ruleset of the branch I can't see the merge option I guess
image
The image after noman approval

@varshith257
Copy link
Member

varshith257 commented Oct 29, 2024

@noman2002 We are just checking if the community members can merge PRS after all workflows passes and 2 approvals :)

@noman2002
Copy link
Member

@varshith257 I think there was changes in unauthorised files and only admin can merge those PRs. May be that is why its not appearing.

@varshith257
Copy link
Member

Yes, for that we have enabled skipping that step with the label ignore-sensitive-files-pr

@palisadoes
Copy link
Contributor

@noman2002 It was because it requires two approvals for the develop branch.
@varshith257 Please work with @govindsingh3477 to open a similar issue in talawa-admin. Then you and another member should approve the work. Let's see if non owners can then merge. The rules allow merges for >= 2 approvals

@palisadoes
Copy link
Contributor

@noman2002 I'm trying to see how we can delegate some of the PR approvals.

@varshith257
Copy link
Member

I, @gautam-divyanshu and @AVtheking also tested it before where there were tests passed and 3 approvals were done and no unauthorized files were changed. I have seen similar behavior

@palisadoes
Copy link
Contributor

@varshith257 Are you saying that with 2 approvals from GitHub members (not owners) you couldn't merge? CodeRabbit doesn't count.

@varshith257
Copy link
Member

varshith257 commented Oct 29, 2024

@palisadoes Yes (approvals are from me, @AVtheking and @gautam-divyanshu )

@palisadoes
Copy link
Contributor

@varshith257 It needs to be approvals from formal GitHub members like you, @AVtheking, @gautam-divyanshu, @pranshugupta54

@palisadoes
Copy link
Contributor

Please try again.

@varshith257
Copy link
Member

Yes! wait let us simulate the same and will tag you

@palisadoes
Copy link
Contributor

I'll be sleeping. Please work with @noman2002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-sensitive-files-pr The contributor has a legitimate reason for editiing protected files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants