From cda076e2a7a058ea24ded70f205e64af169569b3 Mon Sep 17 00:00:00 2001 From: MaxDac <25101798+MaxDac@users.noreply.github.com> Date: Wed, 1 Oct 2025 11:36:57 +0100 Subject: [PATCH 1/3] Fixing Azure provisioning pipeline - GH auth --- .azure/scripts/push-info-to-gh-secrets.sh | 31 ++++++++++++++++++++--- .github/workflows/azure-provision.yml | 10 +++++++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.azure/scripts/push-info-to-gh-secrets.sh b/.azure/scripts/push-info-to-gh-secrets.sh index 3758d648..57952a06 100755 --- a/.azure/scripts/push-info-to-gh-secrets.sh +++ b/.azure/scripts/push-info-to-gh-secrets.sh @@ -7,6 +7,27 @@ set -euo pipefail # deployed managed identity and sets them as GitHub repository secrets. # ----------------------------------------------------------------------------- +# --- Parse command line arguments --- +CI_MODE=false +while [[ $# -gt 0 ]]; do + case $1 in + --ci) + CI_MODE=true + shift + ;; + -h|--help) + echo "Usage: $0 [--ci]" + echo " --ci Skip GitHub CLI authentication check (for CI/CD environments)" + exit 0 + ;; + *) + echo "Unknown option: $1" + echo "Use --help for usage information" + exit 1 + ;; + esac +done + # --- Configuration (update these to match your setup) --- GITHUB_OWNER="MaxDac" GITHUB_REPO="Privee" @@ -29,9 +50,13 @@ if ! command -v gh &> /dev/null; then exit 1 fi -if ! gh auth status > /dev/null 2>&1; then - echo "ERROR: You are not authenticated with GitHub CLI. Please run 'gh auth login'." - exit 1 +if [[ "$CI_MODE" == "false" ]]; then + if ! gh auth status > /dev/null 2>&1; then + echo "ERROR: You are not authenticated with GitHub CLI. Please run 'gh auth login'." + exit 1 + fi +else + echo "✓ Running in CI mode - skipping GitHub CLI authentication check" fi echo "✓ Prerequisites met" diff --git a/.github/workflows/azure-provision.yml b/.github/workflows/azure-provision.yml index b3ebcc79..d66292ff 100644 --- a/.github/workflows/azure-provision.yml +++ b/.github/workflows/azure-provision.yml @@ -72,9 +72,17 @@ jobs: run: | bash ./.azure/scripts/set-secrets-to-dev-kv.sh + - name: Authenticate GitHub CLI + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "$GITHUB_TOKEN" | gh auth login --with-token + - name: Push Azure credentials to GitHub secrets + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - bash ./.azure/scripts/push-info-to-gh-secrets.sh + bash ./.azure/scripts/push-info-to-gh-secrets.sh --ci - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 8ea3d99c0f049c163fd6b3cceb9f535818b84f96 Mon Sep 17 00:00:00 2001 From: MaxDac <25101798+MaxDac@users.noreply.github.com> Date: Wed, 1 Oct 2025 11:40:46 +0100 Subject: [PATCH 2/3] Update .github/workflows/azure-provision.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/azure-provision.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure-provision.yml b/.github/workflows/azure-provision.yml index d66292ff..9010784c 100644 --- a/.github/workflows/azure-provision.yml +++ b/.github/workflows/azure-provision.yml @@ -76,7 +76,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "$GITHUB_TOKEN" | gh auth login --with-token + gh auth login --with-token <<<"$GITHUB_TOKEN" - name: Push Azure credentials to GitHub secrets env: From 7b54aba8b36c19af324ff2a0c14041814ccf1ddc Mon Sep 17 00:00:00 2001 From: MaxDac <25101798+MaxDac@users.noreply.github.com> Date: Wed, 1 Oct 2025 11:40:52 +0100 Subject: [PATCH 3/3] Update .azure/scripts/push-info-to-gh-secrets.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .azure/scripts/push-info-to-gh-secrets.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure/scripts/push-info-to-gh-secrets.sh b/.azure/scripts/push-info-to-gh-secrets.sh index 57952a06..c4a5db9e 100755 --- a/.azure/scripts/push-info-to-gh-secrets.sh +++ b/.azure/scripts/push-info-to-gh-secrets.sh @@ -50,7 +50,7 @@ if ! command -v gh &> /dev/null; then exit 1 fi -if [[ "$CI_MODE" == "false" ]]; then +if ! $CI_MODE; then if ! gh auth status > /dev/null 2>&1; then echo "ERROR: You are not authenticated with GitHub CLI. Please run 'gh auth login'." exit 1