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

support renamed default branches #210

Closed
staabm opened this issue Apr 7, 2020 · 7 comments · Fixed by #278
Closed

support renamed default branches #210

staabm opened this issue Apr 7, 2020 · 7 comments · Fixed by #278
Labels
enhancement New feature or request

Comments

@staabm
Copy link

staabm commented Apr 7, 2020

the ref: input parameter seems to be hardcoded falling back to master.

https://github.com/actions/checkout/blob/master/README.md#L43-L46

since github support renaming the default branch, IMO the actions/checkout action should take this into account and therefore use the 'default-branch' as a fallback instead of always master

@ericsciple ericsciple added the enhancement New feature or request label Apr 15, 2020
@ericsciple
Copy link
Contributor

I wonder whether the default branch can be determined from the github event payload. Would enable implementing without making an extra call to the rest api.

@ericsciple
Copy link
Contributor

It looks like the default branch can be retrieved from the event payload on disk:

      - run: |
          node -p "require(process.env.GITHUB_EVENT_PATH).repository.default_branch"

However that would only work for the workflow repo. For other repositories, would need to either query REST API or fallback to master

@mkalkbrenner
Copy link

mkalkbrenner commented Apr 30, 2020

An example is drupal/drupal which doesn't have a master branch at all which leads to this error:

  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/master:refs/remotes/origin/master
  ##[error]fatal: couldn't find remote ref refs/heads/master
  The process '/usr/bin/git' failed with exit code 128

So from my point of view this is rather a bug than an enhancement ;-)

@ericsciple
Copy link
Contributor

I played with the REST API a little bit. The default branch can be retrieved from the REST API.

I'm in favor of doing this feature, just havent gotten to it yet.

@brettwgreen
Copy link

A lot of people renaming their master branches lately... Haven't looked at this code, but maybe I'll take a look this weekend at making a PR unless you're close to picking this up.

@ericsciple
Copy link
Contributor

looking into this now

@ericsciple
Copy link
Contributor

PR #278 (testing now)

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 a pull request may close this issue.

4 participants