Skip to content

Commit eb43a26

Browse files
committed
Use AUTOMERGE_PAT and simplify meta function
1 parent 3e3c27a commit eb43a26

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

.github/workflows/automerge.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- name: Merge after 10 minutes if PR matches format
3131
env:
32-
GH_TOKEN: ${{ secrets.TAGBOT_PAT }}
32+
GH_TOKEN: ${{ secrets.AUTOMERGE_PAT }}
3333
REPO: ${{ github.repository }}
3434
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
3535

@@ -61,22 +61,11 @@ jobs:
6161
6262
jq = "[.state, (.draft|tostring), .title, .user.login, .base.ref, .head.ref, .head.repo.full_name, .created_at, .head.sha, (.body // \"\" | @base64)] | @tsv"
6363
64-
function meta(; retries=3, delay=5)
65-
for attempt in 1:retries
66-
try
67-
f = split(sh(`gh api repos/$repo/pulls/$pr --jq $jq`), '\t'; keepempty=true)
68-
state,draft,title,author,base,head,head_repo,created,sha,body64 = f
69-
body = String(base64decode(body64))
70-
return (; state,draft,title,author,base,head,head_repo,created,sha,body)
71-
catch e
72-
if attempt < retries
73-
@warn "Failed to fetch PR metadata (attempt $attempt/$retries), retrying in $(delay)s..." exception=e
74-
sleep(delay)
75-
else
76-
rethrow()
77-
end
78-
end
79-
end
64+
function meta()
65+
f = split(sh(`gh api repos/$repo/pulls/$pr --jq $jq`), '\t'; keepempty=true)
66+
state,draft,title,author,base,head,head_repo,created,sha,body64 = f
67+
body = String(base64decode(body64))
68+
return (; state,draft,title,author,base,head,head_repo,created,sha,body)
8069
end
8170
8271
function eligible(m)

0 commit comments

Comments
 (0)