Skip to content

Commit c7d57aa

Browse files
committed
Fixed bug in baseline workflow related to fetching base commit sha
1 parent 41441f7 commit c7d57aa

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

.github/workflows/baseline.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: Baseline
22

33
on:
44
workflow_dispatch:
@@ -254,18 +254,15 @@ jobs:
254254
- name: Checkout repository
255255
uses: actions/checkout@v3
256256

257-
- name: Fetch specific branch
258-
run: git fetch origin {{ github.event.inputs.branch_name }}
259-
260-
- name: Get the latest commit SHA from the branch
261-
id: get_sha
257+
- name: Get the branch name and SHA
262258
run: |
263-
branch_sha=$(git rev-parse origin/{{ github.event.inputs.branch_name }})
264-
echo "sha=$branch_sha" >> $GITHUB_ENV
265-
echo "branch_name={{ github.event.inputs.branch_name }}" >> $GITHUB_ENV
259+
branch_name=${GITHUB_REF#refs/heads/}
260+
commit_sha=$(git rev-parse HEAD)
261+
echo "branch_name=$branch_name" >> $GITHUB_ENV
262+
echo "commit_sha=$commit_sha" >> $GITHUB_ENV
266263
267264
- name: Upload commit SHA as artifact
268265
uses: actions/upload-artifact@v3
269266
with:
270-
name: "base-commit-sha-{{ github.event.inputs.branch_name }}"
271-
path: <(echo -n $sha) # Directly pass the SHA
267+
name: base-commit-sha-${{ env.branch_name }}
268+
path: <(echo -n ${{ env.commit_sha }})

0 commit comments

Comments
 (0)