# Copyright 2022 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Pushes the current repo to github using the secret provided by Secret Manager.
# See: https://console.cloud.google.com/security/secret-manager
#
# This script will only work if you have access to the above service via gcloud.
set -e
TOKEN=$(gcloud --project=crosvm-infra secrets versions access 1 --secret="github-crosvm-bot")
git push --force --all "https://crosvm-bot:${TOKEN}@github.com/google/crosvm.git"

# Copyright 2022 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Pushes the current repo to github using the secret provided by Secret Manager.
# See: https://console.cloud.google.com/security/secret-manager
#
# This script will only work if you have access to the above service via gcloud.
set -e
TOKEN=$(gcloud --project=crosvm-infra secrets versions access 1 --secret="github-crosvm-bot")
git push --force "https://crosvm-bot:${TOKEN}@github.com/google/crosvm.git" HEAD:main

Fix push to github builder
infra: Fix push to github builder

Kokoro would maintain a local main branch in the local checkout,
so pushing --all will push the latest HEAD of main.

Luci will instead put us on a detached HEAD, with the local
main branch unmaintained. So we have been pushing the same old
version of crosvm.

Update the force push to submit HEAD to the remote main.

BUG=b:233913820
TEST=./recipes.py run push_to_github (requires authentication with
github to run)

Change-Id: I8282498382968768d66d9c807b9e86d191977beb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3681989
Reviewed-by: Daniel Verkamp <72bc170b46ec491f7bdd4359a1c0bfed274de40c@chromium.org>
Tested-by: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
