From 46ea50718249a9bab7cbc111fef6c550d686454b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 15 Feb 2023 22:30:39 -0500 Subject: [PATCH] fix: use authenticated requests to the github api in order to generate changelogs for a release --- .github/workflows/release.yml | 3 +++ contrib/release-dokku | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 24b7458d5..edc508e81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,6 +57,9 @@ jobs: git config --global user.email no-reply@dokku.com - name: build package + env: + RELEASE_GITHUB_USERNAME: ${{ secrets.HOMEBREW_GITHUB_USERNAME }} + RELEASE_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} run: contrib/release-dokku ${{ github.event.inputs.release_type }} - name: output version diff --git a/contrib/release-dokku b/contrib/release-dokku index a68a13edd..0a08ca5de 100755 --- a/contrib/release-dokku +++ b/contrib/release-dokku @@ -258,7 +258,17 @@ fn-repo-update-history-and-commit() { for PULL_REQUEST_ID in $(fn-repo-merged-requests "$CURRENT_VERSION"); do ISSUE_FILE="/tmp/github-data/${PULL_REQUEST_ID}.json" if [[ ! -f "$ISSUE_FILE" ]]; then - curl -sS "https://api.github.com/repos/dokku/dokku/issues/${PULL_REQUEST_ID}" >"$ISSUE_FILE" + while true; do + if OUTPUT=$(curl -u "$RELEASE_GITHUB_USERNAME:$RELEASE_GITHUB_API_TOKEN" --fail -sS "https://api.github.com/repos/dokku/dokku/issues/${PULL_REQUEST_ID}" 2>&1); then + echo "$OUTPUT" >"$ISSUE_FILE" + break + fi + + log-error "Error while fetching info for pull/$PULL_REQUEST_ID, sleeping for 5 seconds" + log-error "$OUTPUT" + sleep 5 + log-info " Retrying pull/$PULL_REQUEST_ID" + done fi TITLE="$(jq -r '.title' "$ISSUE_FILE")"