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

Default branch should be the default HEAD branch instead of .* #5311

Open
1 task
nitrocode opened this issue Feb 8, 2025 · 0 comments
Open
1 task

Default branch should be the default HEAD branch instead of .* #5311

nitrocode opened this issue Feb 8, 2025 · 0 comments
Labels
feature New functionality/enhancement

Comments

@nitrocode
Copy link
Member

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Describe the user story

PRs can target feature branches or any branch by default in order to run a terraform plan and apply. This is dangerous because it can circumvent codeowners and apply things outside of normal practices which then results in competing PRs with unintuitive plans.

Imagine this

  1. Bob puts in a pr1 targeting main for dir1 using branch s3-fix
  2. Bob puts in a pr2 targeting s3-fix for dir1 using branch lambda-fix
  3. Bob gets approval by a non codeowner in pr2, atlantis applies pr2 lambda-fix which merges into pr1 s3-fix
  4. Sue puts in pr3 targeting main making a change to the same dir1 as the others. She notices there are lambda reversions in the plan which revert pr2s applied changes
  5. Sue now needs to investigate why these changes appear. She may assume clickops or some other reason. She eventually finds pr2 and then needs to address it with Bob, then maybe help Bob merge pr1 so pr3 can use the latest code in main to avoid reverting pr2

This is very complicated and can be addressed by simply changing the default targeted branch to plan and apply to be master/main.

- id: /.*/
  # branch is an regex matching pull requests by base branch
  # (the branch the pull request is getting merged into).
  # By default, all branches are matched
  # branch: /.*/
  branch: /^(master|main)$/

Describe the solution you'd like

Instead of the default target branch of .*, it would be ideal for it to be the default branch of the repo if the branch key is omitted.

Describe the drawbacks of your solution

Documentation

Describe alternatives you've considered

Maybe change the default to be /^(master|main)$/

@nitrocode nitrocode added the feature New functionality/enhancement label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement
Projects
None yet
Development

No branches or pull requests

1 participant