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

How to checkout the current branch? #20

Closed
zeke opened this issue Aug 24, 2019 · 7 comments
Closed

How to checkout the current branch? #20

zeke opened this issue Aug 24, 2019 · 7 comments

Comments

@zeke
Copy link
Contributor

zeke commented Aug 24, 2019

I want to set up a job that checks out the branch that was pushed. Is it possible to do something like this?

- uses: actions/checkout@${GITHUB_REF}

Reference: https://help.github.com/en/articles/virtual-environments-for-github-actions#environment-variables

@TingluoHuang
Copy link
Member

try:

- uses: actions/checkout@master
  with:
    ref: ${{ github.ref }}

@TingluoHuang
Copy link
Member

BTW, if you just do - uses: actions/checkout@master, it will checkout the GITHUB_SHA, the @master is for versioning this checkout action

@zeke
Copy link
Contributor Author

zeke commented Aug 24, 2019

Ah thanks! Should I open a PR to add something to the README for this use case?

@TingluoHuang
Copy link
Member

sure.

@zeke
Copy link
Contributor Author

zeke commented Aug 24, 2019

Opened a PR: #21

@fbartho
Copy link

fbartho commented Sep 26, 2019

PR is already merged, so this issue could be closed!

@ethomson
Copy link
Contributor

Thanks, @zeke!

jaebradley added a commit to jaebradley/leetgode that referenced this issue Apr 8, 2020
Uses examples from 

* https://github.com/brpaz/github-actions-demo-go
* https://brunopaz.dev/blog/building-a-basic-ci-cd-pipeline-for-a-golang-application-using-github-actions

as guides for setting up GH actions.

Needed to lookup https://github.com/golang/lint to see how to install `golint` locally (properly).

Needed to look at actions/checkout#20 to see how to specify specific branch from GitHub actions.
RookieRick pushed a commit to plangrid/flask-rebar that referenced this issue Aug 4, 2020
Add explicit mention of ref to checkout per actions/checkout#20 (comment) (from the comment that follows this one though I'm not sure why this didn't work before if this DOES fix it.. :P )
mrustl added a commit to mrustl/plattform that referenced this issue Jun 7, 2021
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

4 participants