Skip to content

Commit

Permalink
misc(buildtracker): skip git deepen if no token (#11785)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Dec 8, 2020
1 parent 73f9f52 commit d453d8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 5 additions & 7 deletions .github/scripts/git-get-shared-history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ set -euxo pipefail
# - https://github.com/paularmstrong/build-tracker/issues/106
# - https://github.com/paularmstrong/build-tracker/issues/200

if [[ -z "$BT_API_AUTH_TOKEN" ]]; then
echo "Build tracker auth token not available, skipping git deepening."
exit 0
fi

# We can always use some more history
git -c protocol.version=2 fetch --deepen=100

# Find out if the PR is coming from a fork
base_clone_url=$(jq --raw-output '.pull_request.head.repo.clone_url' $GITHUB_EVENT_PATH)
# If it is, we need the fork's history, too.
if [[ $base_clone_url != "GoogleChrome/lighthouse.git" ]]; then
git -c protocol.version=2 fetch --deepen=100 "$base_clone_url"
fi
echo "History is deepened."

if git merge-base HEAD origin/master > /dev/null; then
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
# buildtracker needs history and a common merge commit.
- name: Fixup git history (for buildtracker)
run: bash $GITHUB_WORKSPACE/.github/scripts/git-get-shared-history.sh
env:
# https://buildtracker.dev/docs/guides/github-actions#configuration
BT_API_AUTH_TOKEN: ${{ secrets.BT_API_AUTH_TOKEN }}
- name: Store in buildtracker
# TODO(paulirish): Don't allow this to fail the build. https://github.com/paularmstrong/build-tracker/issues/200
run: yarn bt-cli upload-build || true
Expand Down

0 comments on commit d453d8c

Please sign in to comment.