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

Branch Ruleset Checks #342

Merged
merged 13 commits into from
Dec 12, 2024
Merged

Branch Ruleset Checks #342

merged 13 commits into from
Dec 12, 2024

Conversation

GrantBirki
Copy link
Member

@GrantBirki GrantBirki commented Dec 12, 2024

Branch Ruleset Checks

This pull request introduces non-blocking safety warnings based off your projects branch rulesets. Rulesets are not to be confused with the classic branch protection settings.

Going forward, you should eventually adopt rulesets over branch protects as they are more robust, implement layering, and can be read via the API without requiring admin rights.

This PR introduces a new use_security_warnings setting that defaults to true. This setting determines whether this Action should log warning messages related to your ruleset settings. If it discovers potentially dangerous or unsafe configurations, it will be loud and warn you about them. If you don't want these warnings, you may disable them with use_security_warnings: false.

If you leave these warnings on, notice them in your logs, and want to resolve them, you can also do so by viewing the documentation around these warnings here.

Example 📸

Screenshot 2024-12-12 at 2 19 00 PM

This example shows a potential misconfiguration or security issue. The project has a ruleset defined for main that requires pull requests but the total PR reviews required is set to 0. This could potentially be an issue as someone could deploy a pull request that has not been approved by other members.


📚 References:

@GrantBirki GrantBirki added the enhancement New feature or request label Dec 12, 2024
@GrantBirki GrantBirki self-assigned this Dec 12, 2024
@GrantBirki GrantBirki changed the title Branch Protection Checks Branch Ruleset Checks Dec 12, 2024
@GrantBirki GrantBirki marked this pull request as ready for review December 12, 2024 22:31
@Copilot Copilot bot review requested due to automatic review settings December 12, 2024 22:31
@GrantBirki GrantBirki merged commit 5d1d9a4 into main Dec 12, 2024
4 checks passed
@GrantBirki GrantBirki deleted the branch-protection-checks branch December 12, 2024 22:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 15 out of 22 changed files in this pull request and generated 1 suggestion.

Files not reviewed (7)
  • src/main.js: Evaluated as low risk
  • src/functions/help.js: Evaluated as low risk
  • src/functions/inputs.js: Evaluated as low risk
  • README.md: Evaluated as low risk
  • action.yml: Evaluated as low risk
  • tests/main.test.js: Evaluated as low risk
  • tests/functions/help.test.js: Evaluated as low risk

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

@@ -480,6 +480,16 @@ inputs:
default:
type: string
required: false
use_security_warnings:
description:
type: string
Copy link
Preview

Copilot AI Dec 12, 2024

Choose a reason for hiding this comment

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

The type for 'description' should be 'boolean' instead of 'string' to match the intended data type.

Suggested change
type: string
description:
type: boolean

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@fabn
Copy link
Contributor

fabn commented Dec 16, 2024

Just a quick note about this PR it will break deploy bot on private free accounts with a message like:

Error: HttpError: Upgrade to GitHub Pro or make this repository public to enable this feature. - https://docs.github.com/rest/repos/rules#get-rules-for-a-branch

@GrantBirki
Copy link
Member Author

@fabn Thank you very much for helping to catch this bug! ⭐ ❤️

I have opened a new pull request to resolve this issue: #345

@fabn
Copy link
Contributor

fabn commented Dec 16, 2024

Thanks for your prompt resolution @GrantBirki 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants