Skip to content

Commit

Permalink
fix(#49): github actions permission denied
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscaner committed Jan 13, 2024
1 parent 5cc9338 commit 060d1f2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
8 changes: 6 additions & 2 deletions .github/actions/bump-casks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ runs:
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ inputs.HOMEBREW_GITHUB_API_TOKEN }}
shell: bash
# 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
# Github Actions: 5000 requests per hour
# 1 * 60 * 24 = 1440 (because bump-pr will checkout a new branch and push to remote)
# 1 concurrent parallel jobs, 1 second delay between jobs.
run: |
parallel -j0 --group --halt now,fail=1 \
'./.github/actions/bump-casks/script.sh {}' \
parallel -j1 --delay 1s --group --halt now,fail=1 \
"./.github/actions/bump-casks/script.sh {}" \
::: $(ls $(brew --repository brewforge/chinese)/Casks/*.rb | xargs -I {} basename {} .rb)
8 changes: 6 additions & 2 deletions .github/actions/bump-formulas/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ runs:
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ inputs.HOMEBREW_GITHUB_API_TOKEN }}
shell: bash
# 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
# Github Actions: 5000 requests per hour
# 1 * 60 * 24 = 1440 (because bump-pr will checkout a new branch and push to remote)
# 1 concurrent parallel jobs, 1 second delay between jobs.
run: |
parallel -j0 --group --halt now,fail=1 \
'./.github/actions/bump-formulas/script.sh {}' \
parallel -j1 --delay 1s --group --halt now,fail=1 \
"./.github/actions/bump-formulas/script.sh {}" \
::: $(ls $(brew --repository brewforge/chinese)/Formula/*.rb | xargs -I {} basename {} .rb)
16 changes: 15 additions & 1 deletion .github/actions/homebrew-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ runs:
using: 'composite'

steps:
- name: Set up git info
shell: bash
run: |
git config --global user.name "Homebrew Scheduler"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
Expand All @@ -17,13 +23,20 @@ runs:
cask: true
test-bot: false

- name: Add parallel cli
# Homebrew/actions/setup-homebrew will checkout the main branch.
# re-checkout myself.
- uses: actions/checkout@v3

- name: Necessary clis
shell: bash
run: |
brew install parallel
# makesure brew livecheck works
brew livecheck parallel
brew install coreutils
brew link --overwrite coreutils
- name: Add Tap
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ inputs.HOMEBREW_GITHUB_API_TOKEN }}
Expand All @@ -32,3 +45,4 @@ runs:
brew tap brewforge/chinese
brew update
brew install ripgrep sd
brew install-bundler-gems --groups "audit,style"
14 changes: 8 additions & 6 deletions .github/workflows/main.yml → .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: CI
name: schedule

on:
pull_request:
branches: [main, bump-*]
push:
branches: [fix-*]
# pull_request:
# branches: [main]
# push:
# branches: [fix-*]
schedule:
# run every 12 hours
# - cron: "20 */12 * * *"
# Every day at 6am
- cron: "0 6 * * *"
# allow run manually
workflow_dispatch: {}
workflow_dispatch:

permissions: write-all

jobs:
casks:
Expand Down

0 comments on commit 060d1f2

Please sign in to comment.