Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
chore(ci): authenticate github.com requests to avoid rate limits
Gabe Kangasfb6ffb6f5e6d
diff --git a/.github/workflows/activitypub-tests.yaml b/.github/workflows/activitypub-tests.yamlindex 9743b3d5a8..aeb7e150ad 100644--- a/.github/workflows/activitypub-tests.yaml+++ b/.github/workflows/activitypub-tests.yaml@@ -54,9 +54,15 @@ jobs:sudo apt-get install -y snac2 ffmpeg- name: Run setup+ env:+ # Authenticates the mkcert download in setup.sh against github.com+ # to avoid the anonymous, shared-per-IP rate limit on CI runners.+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}run: |cd test/automated/activitypub- sudo ./setup.sh+ # Preserve GITHUB_TOKEN across sudo (sudo strips env by default) so+ # setup.sh's github.com downloads use it.+ sudo --preserve-env=GITHUB_TOKEN ./setup.sh- name: Run federation testrun: |@@ -94,9 +100,15 @@ jobs:sudo apt-get install -y snac2 ffmpeg- name: Run setup+ env:+ # Authenticates the mkcert download in setup.sh against github.com+ # to avoid the anonymous, shared-per-IP rate limit on CI runners.+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}run: |cd test/automated/activitypub- sudo ./setup.sh+ # Preserve GITHUB_TOKEN across sudo (sudo strips env by default) so+ # setup.sh's github.com downloads use it.+ sudo --preserve-env=GITHUB_TOKEN ./setup.sh- name: Run chat sanitization testrun: |@@ -162,9 +174,15 @@ jobs:sudo apt-get install -y snac2 ffmpeg jq- name: Run setup+ env:+ # Authenticates the mkcert download in setup.sh against github.com+ # to avoid the anonymous, shared-per-IP rate limit on CI runners.+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}run: |cd test/automated/activitypub- sudo ./setup.sh+ # Preserve GITHUB_TOKEN across sudo (sudo strips env by default) so+ # setup.sh's github.com downloads use it.+ sudo --preserve-env=GITHUB_TOKEN ./setup.sh- name: Run featured streams testtimeout-minutes: 15diff --git a/.github/workflows/automated-end-to-end-api.yaml b/.github/workflows/automated-end-to-end-api.yamlindex b46ce7c4de..e010bf4857 100644--- a/.github/workflows/automated-end-to-end-api.yaml+++ b/.github/workflows/automated-end-to-end-api.yaml@@ -60,6 +60,11 @@ jobs:if: steps.changed-files-yaml.outputs.src_any_changed == 'true'with:version: 'latest' # or pin to an specific version, e.g. "v0.6.10"+ # Authenticate the action's GitHub API calls (release lookup ++ # binary download). Without a token these are anonymous and share+ # the runner IP's 60-requests/hour limit, which routinely trips+ # "API rate limit exceeded". The token raises this to 5,000/hour.+ github-token: ${{ secrets.GITHUB_TOKEN }}- name: Earthly versionif: steps.changed-files-yaml.outputs.src_any_changed == 'true'diff --git a/.github/workflows/browser-testing.yml b/.github/workflows/browser-testing.ymlindex 41b8de13a5..ff944a3f4d 100644--- a/.github/workflows/browser-testing.yml+++ b/.github/workflows/browser-testing.yml@@ -97,6 +97,10 @@ jobs:- name: Run Browser testsif: steps.changed-files-yaml.outputs.testable_any_changed == 'true'uses: nick-fields/retry@v4+ env:+ # Authenticates github.com downloads in tools.sh (ffmpeg) to avoid+ # the anonymous, shared-per-IP rate limit on CI runners.+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}with:timeout_minutes: 20max_attempts: 3diff --git a/.github/workflows/hls-tests.yml b/.github/workflows/hls-tests.ymlindex bd9b1d02f9..ed48278863 100644--- a/.github/workflows/hls-tests.yml+++ b/.github/workflows/hls-tests.yml@@ -32,6 +32,9 @@ env:S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}S3_REGION: ${{ secrets.S3_REGION }}S3_SECRET: ${{ secrets.S3_SECRET }}+ # Authenticates github.com downloads in tools.sh (ffmpeg) to avoid the+ # anonymous, shared-per-IP rate limit on CI runners.+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}jobs:tests:diff --git a/.github/workflows/plugin-tests.yaml b/.github/workflows/plugin-tests.yamlindex ea1a8138a7..3f8ced070b 100644--- a/.github/workflows/plugin-tests.yaml+++ b/.github/workflows/plugin-tests.yaml@@ -55,6 +55,11 @@ jobs:if: steps.changed-files-yaml.outputs.src_any_changed == 'true'with:version: 'latest'+ # Authenticate the action's GitHub API calls (release lookup ++ # binary download). Without a token these are anonymous and share+ # the runner IP's 60-requests/hour limit, which routinely trips+ # "API rate limit exceeded". The token raises this to 5,000/hour.+ github-token: ${{ secrets.GITHUB_TOKEN }}- name: Earthly versionif: steps.changed-files-yaml.outputs.src_any_changed == 'true'diff --git a/test/automated/activitypub/setup.sh b/test/automated/activitypub/setup.shindex 674ccb6df1..d7ecc99bb6 100755--- a/test/automated/activitypub/setup.sh+++ b/test/automated/activitypub/setup.sh@@ -14,6 +14,17 @@ NC='\033[0m'log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }log_error() { echo -e "${RED}[ERROR]${NC} $1"; }+# When a GitHub token is available (e.g. GITHUB_TOKEN forwarded into this+# script in CI), authenticate downloads from github.com so they use the+# 5,000/hour rate limit instead of the anonymous, shared-per-IP 60/hour limit+# that frequently fails on CI runners. Local runs without a token download+# anonymously. curl drops the Authorization header on the cross-host redirect+# to the asset CDN, so the token is not leaked.+gh_curl_auth=()+if [[ -n "${GITHUB_TOKEN:-}" ]]; then+ gh_curl_auth=(-H "Authorization: Bearer ${GITHUB_TOKEN}")+fi+if [[ ${EUID} -ne 0 ]]; thenlog_error "This script must be run as root (sudo ./setup.sh)"exit 1@@ -28,7 +39,7 @@ log_info "Setting up ActivityPub federation test environment..."# 1. Install mkcertif ! command -v mkcert &> /dev/null; thenlog_info "Downloading mkcert..."- curl -sL "https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64" -o /usr/local/bin/mkcert+ curl -sL "${gh_curl_auth[@]}" "https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64" -o /usr/local/bin/mkcertchmod +x /usr/local/bin/mkcertelselog_info "mkcert already installed"@@ -71,7 +82,7 @@ fiif ! command -v caddy &> /dev/null; thenlog_info "Installing Caddy..."CADDY_VERSION="2.8.4"- curl -sL "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz" | tar -xz -C /usr/local/bin caddy+ curl -sL "${gh_curl_auth[@]}" "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz" | tar -xz -C /usr/local/bin caddychmod +x /usr/local/bin/caddylog_info "Caddy installed"elsediff --git a/test/automated/tools.sh b/test/automated/tools.shindex a4d2ffe51b..9b7200702a 100755--- a/test/automated/tools.sh+++ b/test/automated/tools.sh@@ -2,6 +2,18 @@set -e+# When a GitHub token is available (e.g. GITHUB_TOKEN in CI), send it on+# requests to github.com so release-asset downloads use the authenticated+# 5,000/hour rate limit instead of the anonymous, shared-per-IP 60/hour limit+# that frequently fails on CI runners. Local runs without a token are+# unaffected and keep downloading anonymously. curl drops the Authorization+# header on the cross-host redirect to the asset CDN, so the token is not+# leaked to objects.githubusercontent.com.+gh_curl_auth=()+if [[ -n "${GITHUB_TOKEN:-}" ]]; then+ gh_curl_auth=(-H "Authorization: Bearer ${GITHUB_TOKEN}")+fi+function install_ffmpeg() {# install a specific version of ffmpeg@@ -48,7 +60,7 @@ function install_ffmpeg() {echo "Downloading ffmpeg v${FFMPEG_VER} release ${FFMPEG_BUILD_VERSION} for ${ffmpeg_os}/${ffmpeg_arch}"rm -rf ffmpeg.tar.gz- curl -sL --fail "https://github.com/owncast/ffmpeg-builds/releases/download/${FFMPEG_BUILD_VERSION}/${ffmpeg_asset}" --output ffmpeg.tar.gz >/dev/null+ curl -sL --fail "${gh_curl_auth[@]}" "https://github.com/owncast/ffmpeg-builds/releases/download/${FFMPEG_BUILD_VERSION}/${ffmpeg_asset}" --output ffmpeg.tar.gz >/dev/nulltar -xzf ffmpeg.tar.gzrm -f ffmpeg.tar.gzchmod +x ffmpeg