Skip to content

Commit a96e084

Browse files
committed
Fix: Reduce Unauthenticated GitHub Access to Avoid Rate Limit Issue
brew.yaml was commonly hitting a GitHub rate limit by doing unauthenticated GitHub access. We have reduced unauthenticated access in brew.yaml in two ways: 1/ For brew install and test phases, we are providing an access token to brew via the HOMEBREW_GITHUB_API_TOKEN environment variable. We use a fine-grained personal access token restricted to a single repository and with all permissions left on "No Access". and 2/ For brew audit, we cannot use the access token described above - since the brew audit objects to it. So we have simply eliminated doing a brew audit from the workflow. Taken together, these measures seem to be enough to avoid the rate limit issue. homebrew/runformula.sh: Added the "--auditonly" option (but this is not used in the workflow). Also: Update README to Reflect Stable PPA Versions
1 parent 9caa159 commit a96e084

File tree

5 files changed

+37
-37
lines changed

5 files changed

+37
-37
lines changed

.github/workflows/brew.yaml

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2022 Andrea Pappacoda
1+
# SPDX-FileCopyrightText: 2024 Duncan Greatwood
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -31,6 +31,9 @@ jobs:
3131
strategy:
3232
fail-fast: false
3333
matrix:
34+
# Note: If you change the list of OS by adding a newer one,
35+
# PLEASE UPDATE THE AUDIT PHASE to use the most recent macOS
36+
# (See "runformula.sh --auditonly ..." later in this file)
3437
os: [ 'macos-13', 'macos-14', 'macos-15' ]
3538
compiler: [ 'clang' ]
3639
sanitizer: [ 'none' ]
@@ -76,16 +79,20 @@ jobs:
7679
export CC
7780
echo "CXX is $CXX; CC is $CC"
7881
79-
# Note - if you get the GitHub error:
80-
# GitHub API Error: API rate limit exceeded for aa.bb.cc.dd...
81-
# Then try rerunning the job in 20-25 minutes
82+
# This is a fine-grained personal access token restricted to a
83+
# single repository and with all permissions left on "No
84+
# Access". We set this token to avoid being blocked by the
85+
# GitHub access rate limit for unauthenticated access
86+
# (i.e. the rate limit for access with no token).
87+
export HOMEBREW_GITHUB_API_TOKEN=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
8288
83-
homebrew/runformula.sh -y --force --HEAD
84-
# -y Say "yes" to doing the brew audit
85-
# --force Run even if pistache brew formula unchanged
86-
# --HEAD Test with head of pistacheio/pistache master branch
89+
homebrew/runformula.sh --skipaudit --force --HEAD
90+
# --skipaudit Say "yes" to doing the brew audit
91+
# --force Run even if pistache brew formula unchanged
92+
# --HEAD Test with head of pistacheio/pistache master
93+
# branch
8794
8895
# if brew list pistache &>/dev/null; then brew remove pistache; fi
89-
# # Use release (not HEAD), do audit (-y), and force even if pistache
90-
# # formula unchanged
96+
## Use release (not HEAD), do audit (-y), and force even if pistache
97+
## formula unchanged
9198
# homebrew/runformula.sh -y --force

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ $ sudo apt install libpistache-dev
109109

110110
### Ubuntu PPA (Stable)
111111

112-
Currently there are no stable release of Pistache published into the [stable](https://launchpad.net/~pistache+team/+archive/ubuntu/stable) PPA. However, when that time comes, run the following to install a stable package:
112+
From time to time, the project transfers release packages into the [stable](https://launchpad.net/~pistache+team/+archive/ubuntu/stable) PPA. Run the following to install a stable package:
113113

114114
```sh
115115
$ sudo add-apt-repository ppa:pistache+team/stable

homebrew/runformula.sh

+18-8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ do_yes=false
3636
do_usage=false
3737
use_head=false
3838
skip_audit=false
39+
audit_only=false
3940
do_force=false
4041
optspec=":hfy-:"
4142
while getopts "$optspec" optchar; do
@@ -51,6 +52,9 @@ while getopts "$optspec" optchar; do
5152
skipaudit)
5253
skip_audit=true
5354
;;
55+
auditonly)
56+
audit_only=true
57+
;;
5458
force)
5559
do_force=true
5660
;;
@@ -87,6 +91,7 @@ if [ "$do_usage" = true ]; then
8791
echo " -f, --force Test even if forumla already up-to-date"
8892
echo " -y Answer yes to questions (i.e. do audit)"
8993
echo " --skipaudit Skips brew audit; overrides -y for audit question"
94+
echo " --auditonly Skips brew install, does audit"
9095
if [ "$do_yes" = true ] || [ "$do_head" = true ]; then
9196
echo "Error: Usage requested with other options"
9297
do_error=true
@@ -161,19 +166,24 @@ else
161166
echo "Copying $MY_SCRIPT_DIR/pistache.rb to $pist_form_file"
162167
fi
163168

164-
# Drop copyright + license SPDX message when adding forumla to homebrew/core
165-
sed '1,6d' "$MY_SCRIPT_DIR/pistache.rb" >"$pist_form_file"
169+
if [ "$audit_only" != true ]; then
170+
# Drop copyright + license SPDX message when adding forumla to homebrew/core
171+
sed '1,6d' "$MY_SCRIPT_DIR/pistache.rb" >"$pist_form_file"
166172

167-
if brew list pistache &>/dev/null; then brew remove pistache; fi
168-
if [ "$use_head" = true ]; then
169-
brew install --HEAD pistache
170-
else
171-
brew install --build-from-source pistache
173+
if brew list pistache &>/dev/null; then brew remove pistache; fi
174+
if [ "$use_head" = true ]; then
175+
brew install --HEAD pistache
176+
else
177+
brew install --build-from-source pistache
178+
fi
179+
brew test --verbose pistache
172180
fi
173-
brew test --verbose pistache
174181

175182
if [ "$skip_audit" != true ]; then
176183
do_audit=$do_yes
184+
if [ "$do_audit" != true ]; then
185+
do_audit=$audit_only
186+
fi
177187
if [ "$do_audit" != true ]; then
178188
read -e -p 'brew audit? [y/N]> '
179189
if [[ "$REPLY" == [Yy]* ]]; then

meson.build

-17
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,6 @@ if get_option('b_coverage')
3636
add_project_arguments(compiler.get_supported_arguments(['-fstack-protector-all', '--param=ssp-buffer-size=4']), language: 'cpp')
3737
endif
3838

39-
# howardhinnant/date has several names - look for them, from the most
40-
# to the least explicit name.
41-
# In Meson 0.60.0, this can be replaced with a simpler:
42-
#
43-
# dependency('howardhinnant-date', 'hinnant-date', 'date')
44-
#
45-
date_dep = dependency('howard-hinnant-date', required: false)
46-
if not date_dep.found()
47-
date_dep = dependency('howardhinnant-date', required: false)
48-
endif
49-
if not date_dep.found()
50-
date_dep = dependency('hinnant-date', required: false)
51-
endif
52-
if not date_dep.found()
53-
date_dep = dependency('date', fallback: ['hinnant-date', 'date_dep'])
54-
endif
55-
5639
deps_libpistache = [
5740
dependency('threads')
5841
]

version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.27.20241223
1+
0.4.27.20241227

0 commit comments

Comments
 (0)