Controlling git hub branch creation #166642
Replies: 5 comments 2 replies
-
Hi @kirannvkumar! GitHub Actions alone cannot prevent or restrict branch creation—branch protection and creation policies are managed by GitHub repository settings and not by Actions. However, you can use a combination of GitHub Actions and branch protection rules to enforce workflows after a branch is created. If you want to ensure that a "release" branch is only created from "master", you can do the following:
Here’s an example workflow idea:
Let me know if you want a sample workflow for this! |
Beta Was this translation helpful? Give feedback.
-
Hi @KiranVKumar! Happy to help you with a sample workflow. Here are a few workflow examples that will help you control release branch creation: Simple Release Branch Control
Advanced Branch Creation Monitor
Setup Instructions:
How it works:
The key command Let me know if you need any modifications to this workflow or have questions about implementation! |
Beta Was this translation helpful? Give feedback.
-
Hi @kirannvkumar! GitHub Actions alone cannot prevent or restrict branch creation—branch protection and creation policies are managed by GitHub repository settings and not by Actions. However, you can use a combination of GitHub Actions and branch protection rules to enforce workflows after a branch is created. If you want to ensure that a "release" branch is only created from "master", you can do the following: Set up branch protection rules to control who can push to protected branches. Use the create event in your workflow to trigger when a branch is created. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response @2006pritam, it would be benificial if you could provide me a sample flow, thank you !! |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Misc
Discussion Details
Is it possible to restrict branch creation in github such as release branch to be created only from master branch using github actions ?
Beta Was this translation helpful? Give feedback.
All reactions