From b8fe363e584ce581432c9d5c509ba4fde6e450d7 Mon Sep 17 00:00:00 2001 From: Dani-Koza-AF Date: Sun, 27 Oct 2024 15:50:41 +0200 Subject: [PATCH] fix CI auth --- .github/workflows/deploy-to-QA.yml | 10 +++++++++- .github/workflows/pre-release-workflow.yml | 11 ++++++++++- .../workflows/release-Production-workflow.yml | 18 +++++++++++++----- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-to-QA.yml b/.github/workflows/deploy-to-QA.yml index e37759a..eae62d2 100644 --- a/.github/workflows/deploy-to-QA.yml +++ b/.github/workflows/deploy-to-QA.yml @@ -9,6 +9,9 @@ jobs: environment: Staging steps: - uses: actions/checkout@v3 + with: + token: ${{ secrets.CI_DEV_GITHUB_TOKEN }} + persist-credentials: true - name: Setup Node.js uses: actions/setup-node@v3 with: @@ -17,13 +20,18 @@ jobs: run: | npm i rimraf - - name: Login to Github + - name: Setup Git Authentication env: COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }} COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }} + MY_PERSONAL_ACCESS_TOKEN: ${{ secrets.CI_DEV_GITHUB_TOKEN }} run: | git config --global user.name $COMMIT_AUTHOR git config --global user.email $COMMIT_EMAIL + git config --global credential.helper 'cache --timeout=300' + git config --global --add "credential.https://github.com.username" "x-access-token" + echo "https://x-access-token:$MY_PERSONAL_ACCESS_TOKEN@github.com" > ~/.git-credentials + - uses: mdecoleman/pr-branch-name@2.0.0 id: vars with: diff --git a/.github/workflows/pre-release-workflow.yml b/.github/workflows/pre-release-workflow.yml index f723bb2..4bd9f1e 100644 --- a/.github/workflows/pre-release-workflow.yml +++ b/.github/workflows/pre-release-workflow.yml @@ -11,13 +11,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Login to Github + with: + token: ${{ secrets.CI_DEV_GITHUB_TOKEN }} + persist-credentials: true + + - name: Setup Git Authentication env: COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }} COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }} + MY_PERSONAL_ACCESS_TOKEN: ${{ secrets.CI_DEV_GITHUB_TOKEN }} run: | git config --global user.name $COMMIT_AUTHOR git config --global user.email $COMMIT_EMAIL + git config --global credential.helper 'cache --timeout=300' + git config --global --add "credential.https://github.com.username" "x-access-token" + echo "https://x-access-token:$MY_PERSONAL_ACCESS_TOKEN@github.com" > ~/.git-credentials + - uses: mdecoleman/pr-branch-name@2.0.0 id: vars with: diff --git a/.github/workflows/release-Production-workflow.yml b/.github/workflows/release-Production-workflow.yml index 98e250c..e4355cd 100644 --- a/.github/workflows/release-Production-workflow.yml +++ b/.github/workflows/release-Production-workflow.yml @@ -29,6 +29,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + token: ${{ secrets.CI_DEV_GITHUB_TOKEN }} + persist-credentials: true - name: Setup Node.js uses: actions/setup-node@v3 with: @@ -37,13 +40,18 @@ jobs: run: | npm i rimraf - - name: Login to Github + - name: Setup Git Authentication env: - COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }} - COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }} + COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }} + COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }} + MY_PERSONAL_ACCESS_TOKEN: ${{ secrets.CI_DEV_GITHUB_TOKEN }} run: | - git config --global user.name $COMMIT_AUTHOR - git config --global user.email $COMMIT_EMAIL + git config --global user.name $COMMIT_AUTHOR + git config --global user.email $COMMIT_EMAIL + git config --global credential.helper 'cache --timeout=300' + git config --global --add "credential.https://github.com.username" "x-access-token" + echo "https://x-access-token:$MY_PERSONAL_ACCESS_TOKEN@github.com" > ~/.git-credentials + - uses: mdecoleman/pr-branch-name@2.0.0 id: vars with: