Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/scripts/download_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,18 @@ echo "Downloading packages from $REPO releases"
# makes stale versions look supported.
# ---------------------------------------------------------------------------

# Unauthenticated calls share 60 requests/hour per runner IP and fail CI at random.
github_api() {
if [ -n "${GH_TOKEN:-}" ]; then
# Header via stdin keeps the token out of argv.
curl -fqs -H @- "$@" <<<"Authorization: Bearer $GH_TOKEN"
else
curl -fqs "$@"
fi
}

RELEASES_JSON=$(mktemp)
if ! curl -fqs "https://api.github.com/repos/${REPO}/releases?per_page=100" > "$RELEASES_JSON"; then
if ! github_api "https://api.github.com/repos/${REPO}/releases?per_page=100" > "$RELEASES_JSON"; then
echo "Error: Could not fetch release list"
exit 1
fi
Expand Down Expand Up @@ -221,7 +231,7 @@ mkdir -p out/packages

for tag in "$PRIMARY_TAG"; do

if ! release=$(curl -fqs "https://api.github.com/repos/${REPO}/releases/tags/$tag"); then
if ! release=$(github_api "https://api.github.com/repos/${REPO}/releases/tags/$tag"); then
echo "::error::Could not fetch selected release $tag"
exit 1
fi
Expand Down Expand Up @@ -328,7 +338,7 @@ rm -f "$RELEASES_JSON" "$SEEN_FILE"

# release-info.json describes the primary release only: it is the "what is the
# current version" feed for the site, not an inventory of the pool.
release=$(curl -fqs "https://api.github.com/repos/${REPO}/releases/tags/${PRIMARY_TAG}")
# $release still holds PRIMARY_TAG from the download loop.
echo "$release" | python3 -c "
import sys, json
data = json.load(sys.stdin)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ jobs:
fi
- name: Download DocumentDB packages for the stable and latest channels
if: steps.features.outputs.packages == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
.github/scripts/download_packages.sh
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
- name: Generate stable from v1.0-0 and latest from the newest release
env:
DOCUMENTDB_VERSION: v1.0-0
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
.github/scripts/download_packages.sh
Expand Down
Loading