Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(buildtracker): skip git deepen if no token #11785

Merged
merged 2 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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