Skip to content

Commit d3e2b67

Browse files
committed
fix(Brewforge#49): github actions permission denied
1 parent 5cc9338 commit d3e2b67

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

.github/actions/bump-casks/action.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ runs:
1212
- name: Bump outdated casks
1313
# continue-on-error: true
1414
env:
15+
HOMEBREW_DEVELOPER: '1'
1516
HOMEBREW_GITHUB_API_TOKEN: ${{ inputs.HOMEBREW_GITHUB_API_TOKEN }}
1617
shell: bash
18+
# https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#primary-rate-limit-for-authenticated-users
19+
# Github Actions: 5000 requests per hour
20+
# 1 * 60 * 24 = 1440 (because bump-pr will checkout a new branch and push to remote)
21+
# 1 concurrent parallel jobs, 1 second delay between jobs.
1722
run: |
18-
parallel -j0 --group --halt now,fail=1 \
19-
'./.github/actions/bump-casks/script.sh {}' \
23+
parallel -j1 --delay 1s --group --halt now,fail=1 \
24+
"./.github/actions/bump-casks/script.sh {}" \
2025
::: $(ls $(brew --repository brewforge/chinese)/Casks/*.rb | xargs -I {} basename {} .rb)

.github/actions/bump-formulas/action.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ runs:
1212
- name: Bump outdated formulas
1313
# continue-on-error: true
1414
env:
15+
HOMEBREW_DEVELOPER: '1'
1516
HOMEBREW_GITHUB_API_TOKEN: ${{ inputs.HOMEBREW_GITHUB_API_TOKEN }}
1617
shell: bash
18+
# https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#primary-rate-limit-for-authenticated-users
19+
# Github Actions: 5000 requests per hour
20+
# 1 * 60 * 24 = 1440 (because bump-pr will checkout a new branch and push to remote)
21+
# 1 concurrent parallel jobs, 1 second delay between jobs.
1722
run: |
18-
parallel -j0 --group --halt now,fail=1 \
19-
'./.github/actions/bump-formulas/script.sh {}' \
23+
parallel -j1 --delay 1s --group --halt now,fail=1 \
24+
"./.github/actions/bump-formulas/script.sh {}" \
2025
::: $(ls $(brew --repository brewforge/chinese)/Formula/*.rb | xargs -I {} basename {} .rb)

.github/actions/homebrew-env/action.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,22 @@ runs:
1616
core: true
1717
cask: true
1818
test-bot: false
19+
token: ${{ inputs.HOMEBREW_GITHUB_API_TOKEN }}
1920

20-
- name: Add parallel cli
21+
# Homebrew/actions/setup-homebrew will checkout the main branch.
22+
# re-checkout myself.
23+
- uses: actions/checkout@v3
24+
25+
- name: Necessary clis
2126
shell: bash
2227
run: |
2328
brew install parallel
2429
# makesure brew livecheck works
2530
brew livecheck parallel
2631
32+
brew install coreutils
33+
brew link --overwrite coreutils
34+
2735
- name: Add Tap
2836
env:
2937
HOMEBREW_GITHUB_API_TOKEN: ${{ inputs.HOMEBREW_GITHUB_API_TOKEN }}
@@ -32,3 +40,4 @@ runs:
3240
brew tap brewforge/chinese
3341
brew update
3442
brew install ripgrep sd
43+
brew install-bundler-gems --groups "audit,style"

.github/workflows/main.yml .github/workflows/schedule.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: CI
1+
name: schedule
22

33
on:
4-
pull_request:
5-
branches: [main, bump-*]
4+
# pull_request:
5+
# branches: [main]
66
push:
77
branches: [fix-*]
88
schedule:
@@ -11,7 +11,9 @@ on:
1111
# Every day at 6am
1212
- cron: "0 6 * * *"
1313
# allow run manually
14-
workflow_dispatch: {}
14+
workflow_dispatch:
15+
16+
permissions: write-all
1517

1618
jobs:
1719
casks:

0 commit comments

Comments
 (0)