# 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

# 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 latest --secret="github-crosvm-bot")
git push --force "https://crosvm-bot:${TOKEN}@github.com/google/crosvm.git" HEAD:main

Use latest version of github secret
infra: Use latest version of github secret

The previous token expired and a new one was created and added to
GCP secrets manager.
This CL updates the script run by CI to always use the latest
secret instead of a fixed version.

BUG=None
TEST=sh push_to_github.sh

Change-Id: I7eff1a8b385b5cd48206ef54aad65151dfbbc961
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751430
Commit-Queue: Dennis Kempin <cd09796fb571bec2782819dbfd33307f65b1c778@google.com>
Reviewed-by: Daniel Verkamp <72bc170b46ec491f7bdd4359a1c0bfed274de40c@chromium.org>
Tested-by: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
