-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (56 loc) · 1.9 KB
/
Copy pathupdate-formula-list.yml
File metadata and controls
71 lines (56 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Update Formulae List
on:
push:
branches:
- main
paths:
- "Formula/**"
schedule:
- cron: "0 0 * * 0"
permissions:
contents: write
# Keep only the newest run for a given ref.
# Side effect: older commits can show a cancelled check in GitHub's UI because
# concurrency cancellation is reported as cancelled, not skipped/successful.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
HOMEBREW_NO_REQUIRE_TAP_TRUST: 1
jobs:
update-list:
runs-on: macos-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- run: brew update
- name: Tap the repo
run: brew tap chenrui333/tap
- name: Run update-list script
run: .github/scripts/update-list.sh
- name: Push changes back
if: always()
run: |
git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main
git rev-parse --verify refs/remotes/origin/main >/dev/null
if git merge-base --is-ancestor HEAD refs/remotes/origin/main; then
echo "No local commit to push."
exit 0
fi
for attempt in {1..3}; do
git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main
git rev-parse --verify refs/remotes/origin/main >/dev/null
if ! git rebase refs/remotes/origin/main; then
echo "Failed to rebase generated formula list onto origin/main." >&2
git rebase --abort || true
exit 1
fi
if git push origin HEAD:main; then
exit 0
fi
echo "Push attempt $attempt failed; retrying after refreshing main."
sleep "$((attempt * 5))"
done
echo "Failed to push generated formula list after 3 attempts." >&2
exit 1