From 2b8247b2dad5913365a455e7a09e463cbb447c45 Mon Sep 17 00:00:00 2001 From: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> Date: Mon, 22 May 2023 12:12:19 +0100 Subject: [PATCH] Gh-2960: Git user shows as invalid for commits made by GitHub Actions (#2961) * Set credentials to be GitHub Actions Bot * Remove redundent step from Koryphe action and improve PR details * Remove redundent step from release and use of Admin token when not required * Upgrade Action versions --- .github/workflows/codeql.yaml | 2 +- .github/workflows/create-hotfix-branch.yaml | 6 +-- .github/workflows/create-release-branch.yaml | 6 +-- .github/workflows/release-standalone.yaml | 4 +- .github/workflows/release.yaml | 40 +++++++------------ .github/workflows/update-koryphe-version.yaml | 13 +++--- 6 files changed, 30 insertions(+), 41 deletions(-) diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 0f34586a8b1..f4742b8920b 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -22,7 +22,7 @@ jobs: fetch-depth: 0 - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '8' diff --git a/.github/workflows/create-hotfix-branch.yaml b/.github/workflows/create-hotfix-branch.yaml index 895be2629d5..a3d14b3a4bf 100644 --- a/.github/workflows/create-hotfix-branch.yaml +++ b/.github/workflows/create-hotfix-branch.yaml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout master - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: master token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -65,8 +65,8 @@ jobs: - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Update versions run: | diff --git a/.github/workflows/create-release-branch.yaml b/.github/workflows/create-release-branch.yaml index f4c698f83ef..f69895551cc 100644 --- a/.github/workflows/create-release-branch.yaml +++ b/.github/workflows/create-release-branch.yaml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout develop - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: develop token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -65,8 +65,8 @@ jobs: - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Update versions run: | diff --git a/.github/workflows/release-standalone.yaml b/.github/workflows/release-standalone.yaml index 15840055d6f..e66c06c86f0 100644 --- a/.github/workflows/release-standalone.yaml +++ b/.github/workflows/release-standalone.yaml @@ -7,13 +7,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '8' - name: Checkout Branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Decode CodeSigning key env: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b3d984f0771..33e9a5ed8e7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,22 +19,21 @@ jobs: steps: - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '8' - name: Checkout master - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: master - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} fetch-depth: 0 - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Set release version run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV @@ -50,13 +49,6 @@ jobs: if: ${{ !env.BRANCH_NAME }} run: exit 1 - - name: Checkout master - uses: actions/checkout@v2 - with: - ref: master - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - fetch-depth: 0 - - name: Merge release into master run: | git checkout ${{ env.BRANCH_NAME }} @@ -76,19 +68,18 @@ jobs: steps: - name: Checkout develop - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: develop - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} fetch-depth: 0 - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '8' @@ -115,7 +106,7 @@ jobs: steps: - name: Checkout Master - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: master @@ -143,18 +134,17 @@ jobs: steps: - name: Checkout Master - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: master - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '11' @@ -185,13 +175,13 @@ jobs: steps: - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '8' - name: Checkout release - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ needs.create-release-tag.outputs.branch_name }} diff --git a/.github/workflows/update-koryphe-version.yaml b/.github/workflows/update-koryphe-version.yaml index 3209b21e001..59b4b45fa72 100644 --- a/.github/workflows/update-koryphe-version.yaml +++ b/.github/workflows/update-koryphe-version.yaml @@ -15,20 +15,17 @@ jobs: steps: - name: Checkout branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - - name: Get branch name - run: echo "SOURCE_BRANCH=$(git branch --show-current)" >> $GITHUB_ENV - - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '8' @@ -43,3 +40,5 @@ jobs: source_branch: ${{ env.VERSION_UPDATE_BRANCH }} destination_branch: ${{ env.SOURCE_BRANCH }} github_token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + pr_title: "Update Koryphe version to ${{ github.event.inputs.version }}" + pr_body: "Automated GitHub Actions PR to upgrade to version ${{ github.event.inputs.version }} of Koryphe"