Skip to content

Commit 3114560

Browse files
authored
fix(ci): setup git and gh (#4834)
1 parent 7ad1420 commit 3114560

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/pr-sync.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
image: alpine
2121

2222
steps:
23+
- name: Install git
24+
run: apk add --no-cache git
25+
shell: sh
26+
2327
- name: Checkout
2428
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2529

@@ -39,15 +43,24 @@ jobs:
3943
id: pr-number
4044
shell: sh
4145
env:
46+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4247
max_attempts: 5 # Maximum attempts to find the PR number
4348
sleep_time: 3 # Time to wait between attempts in seconds
4449
run: |
4550
. ./scripts/lib.sh
4651
52+
if ! git config --global --add safe.directory "${GITHUB_WORKSPACE}"; then
53+
die "Failed to add safe.directory to git config."
54+
fi
55+
4756
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
4857
num="${{ github.event.inputs.pr_number }}"
4958
else
5059
commit_sha=$(git rev-parse HEAD)
60+
if [ -z "${commit_sha}" ]; then
61+
die "Failed to get the current commit SHA."
62+
fi
63+
5164
# Try up to 5 times to find the merged PR for this commit.
5265
attempts=0
5366
info "Searching for merged PR number for commit: ${commit_sha}"

0 commit comments

Comments
 (0)