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

Add an option to create a new branch from the default branch if the specified ref does not exist #1920

Open
Shion1305 opened this issue Sep 29, 2024 · 0 comments

Comments

@Shion1305
Copy link

Problem

Currently, when using actions/checkout, specifying a ref that does not exist causes the action to fail. In some workflows, it would be more efficient if, when the specified branch does not exist, a new branch could be automatically created from the default branch.

Proposed Solution

I propose adding an auto-create option to actions/checkout. This option would allow the action to:

  1. Checkout the default branch (e.g., main) if the specified ref does not exist.
  2. Create a new branch with the specified ref from the default branch.

This behavior would only occur when the auto-create option is enabled, keeping the current behavior unchanged by default.

Example YAML

- name: Checkout code
  uses: actions/checkout@v3
  with:
    ref: 'feature-branch'
    auto-create: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant