Skip to content

Commit

Permalink
Add branch option to checkout on push
Browse files Browse the repository at this point in the history
  • Loading branch information
znz committed Jan 11, 2020
1 parent 7584853 commit e62aead
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
# Not using official actions/checkout because it's unstable and sometimes doesn't work for a fork.
- name: Checkout ruby
run: |
git clone --single-branch --shallow-since=yesterday https://github.com/${{ github.repository }} src
git clone --single-branch --shallow-since=yesterday --branch=${GITHUB_REF#refs/heads/} https://github.com/${{ github.repository }} src
git -C src reset --hard ${{ github.sha }}
if: github.event_name == 'push'
shell: cmd
shell: bash
- name: Checkout a pull request
run: |
git clone --single-branch --shallow-since=yesterday --branch=${{ github.event.pull_request.head.ref }} https://github.com/${{ github.event.pull_request.head.repo.full_name }} src
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# Not using official actions/checkout because it's unstable and sometimes doesn't work for a fork.
- name: Checkout ruby
run: |
git clone --single-branch --shallow-since=yesterday https://github.com/${{ github.repository }} src
git clone --single-branch --shallow-since=yesterday --branch=${GITHUB_REF#refs/heads/} https://github.com/${{ github.repository }} src
git -C src reset --hard "$GITHUB_SHA"
if: github.event_name == 'push'
- name: Checkout a pull request
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ jobs:
# Not using official actions/checkout@v2 because it's unstable.
- name: Checkout ruby
run: |
git clone --single-branch --shallow-since=yesterday https://github.com/${{ github.repository }} src
git clone --single-branch --shallow-since=yesterday --branch=${GITHUB_REF#refs/heads/} https://github.com/${{ github.repository }} src
git -C src reset --hard "$GITHUB_SHA"
if: github.event_name == 'push'
shell: bash
- name: Checkout a pull request
run: |
git clone --single-branch --shallow-since=yesterday --branch=${{ github.event.pull_request.head.ref }} https://github.com/${{ github.event.pull_request.head.repo.full_name }} src
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mjit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# Not using official actions/checkout because it's unstable and sometimes doesn't work for a fork.
- name: Checkout ruby
run: |
git clone --single-branch --shallow-since=yesterday https://github.com/${{ github.repository }} src
git clone --single-branch --shallow-since=yesterday --branch=${GITHUB_REF#refs/heads/} https://github.com/${{ github.repository }} src
git -C src reset --hard "$GITHUB_SHA"
if: github.event_name == 'push'
- name: Checkout a pull request
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
# Not using official actions/checkout because it's unstable and sometimes doesn't work for a fork.
- name: Checkout ruby
run: |
git clone --single-branch --shallow-since=yesterday https://github.com/${{ github.repository }} src
git clone --single-branch --shallow-since=yesterday --branch=${GITHUB_REF#refs/heads/} https://github.com/${{ github.repository }} src
git -C src reset --hard "$GITHUB_SHA"
if: github.event_name == 'push'
- name: Checkout a pull request
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ jobs:
# Not using official actions/checkout because it's unstable and sometimes doesn't work for a fork.
- name: Checkout ruby
run: |
git clone --single-branch --shallow-since=yesterday https://github.com/${{ github.repository }} src
git clone --single-branch --shallow-since=yesterday --branch=${GITHUB_REF#refs/heads/} https://github.com/${{ github.repository }} src
git -C src reset --hard ${{ github.sha }}
if: github.event_name == 'push'
shell: bash
- name: Checkout a pull request
run: |
git clone --single-branch --shallow-since=yesterday --branch=${{ github.event.pull_request.head.ref }} https://github.com/${{ github.event.pull_request.head.repo.full_name }} src
Expand Down

0 comments on commit e62aead

Please sign in to comment.