From 40f6c6bb39363d2a0eab8c7dcd70212c98832828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Wed, 31 Jul 2024 16:27:39 +0200 Subject: [PATCH] test: Use hard-coded user_name in CI The gh tool doesn't has permissions in CI and a using a hard-coded user_name is sufficient. --- .github/workflows/smoke-tests.yml | 1 - testing/smoketest/get_username.sh | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index 524d0a79..f5042b71 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -20,7 +20,6 @@ jobs: test: runs-on: ubuntu-latest env: - GH_TOKEN: ${{ github.token }} SSH_KEY: "./id_rsa_terraform" TF_VAR_private_key: "./id_rsa_terraform" TF_VAR_public_key: "./id_rsa_terraform.pub" diff --git a/testing/smoketest/get_username.sh b/testing/smoketest/get_username.sh index abfb74d3..c179cd2f 100755 --- a/testing/smoketest/get_username.sh +++ b/testing/smoketest/get_username.sh @@ -1,7 +1,11 @@ #!/bin/bash -eu +: ${CI:=""} + +if [ -z "$CI" ]; then + user_name="github-actions" # The gh command is faster and not as hacky as the fallback solution -if which gh >/dev/null; then +elif which gh >/dev/null; then user_name=$(gh api user -q ".login") else user_name=$(ssh -T git@github.com 2>&1|cut -d'!' -f1|cut -d' ' -f2)