Skip to content

Commit 421798e

Browse files
committedJun 17, 2024
fix: Checkout correct branch
1 parent daca3d1 commit 421798e

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed
 

‎.github/workflows/release.yml

+14-4
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,22 @@ jobs:
4141
fail-fast: false
4242
runs-on: ubuntu-22.04
4343
steps:
44-
- name: checkout
44+
- name: clone
4545
run: |
4646
# can't use actions/checkout here as transferring the shallow clone fails when using upload-/download-artifact
47-
git clone https://token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY . --depth=1
48-
env:
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
git clone https://github.com/$GITHUB_REPOSITORY . --depth=1
48+
- name: checkout PR
49+
if: ${{ github.event_name == 'pull_request' }}
50+
run: |
51+
echo fetching pull/${{ github.ref_name }}
52+
git fetch origin pull/${{ github.ref_name }}:pr --depth=1
53+
git checkout pr
54+
- name: checkout branch
55+
if: ${{ github.event_name == 'push' }}
56+
run: |
57+
echo fetching ${{ github.ref_name }}
58+
git fetch origin ${{ github.ref_name }} --depth=1
59+
git checkout ${{ github.ref_name }}
5060
- name: Set up Go
5161
uses: actions/setup-go@v5
5262
with:

‎hack/build-tag.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ go run ./pip/generate
3535
TAG=v0.0.0-$PYTHON_VERSION-$PYTHON_STANDALONE_VERSION-$BUILD_NUM
3636

3737
echo "checking out temporary branch"
38-
git checkout $(git rev-parse HEAD)
38+
git checkout --detach
3939
git add -f python/internal/data
4040
git add -f pip/internal/data
4141
git commit -m "added python $PYTHON_VERSION from python-standalone $PYTHON_STANDALONE_VERSION"

0 commit comments

Comments
 (0)