From 27c25b0f68f13f566db2f20b9832f9a0e01dcbb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Wed, 26 Jul 2023 16:27:37 +0200 Subject: [PATCH 001/128] Adding latest workflow run check to post-pull-request.yml --- .../post-pull-request-checks-automation.yml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 7d35826a2..70d75b7ce 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -1,5 +1,8 @@ name: Post Pull Request Checks Automation +env: + RUN_ONLY_LATEST_WORKFLOW: 'true' + on: workflow_call: secrets: @@ -45,9 +48,26 @@ on: description: Configuration for the timeout-minutes parameter of the workflow. jobs: + get_latest_workflow: + name: Get the latest workflow run number + runs-on: ubuntu-latest + outputs: + latest_run_number: ${{ steps.get_latest_workflow_run_number.outputs.latest_run_number }} + steps: + - name: Get the latest workflow run number + id: get_latest_workflow_run_number + run: | + LATEST_RUN_NUMBER=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/${{ github.repository }}/actions/runs?event=push" \ + | jq '.workflow_runs[0].run_number') + echo "::set-output name=latest_run_number::$LATEST_RUN_NUMBER" + post-pull-request-checks-automation: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} + if: | + env.RUN_ONLY_LATEST_WORKFLOW == 'false' || github.run_number == needs.get_latest_workflow.outputs.latest_run_number steps: - name: Set Merge Token shell: pwsh From 714666e6fc092a8008c00c6b6a90016fa6ba207f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 09:08:12 +0200 Subject: [PATCH 002/128] Removing env. --- .github/workflows/post-pull-request-checks-automation.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 70d75b7ce..072ba679f 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -1,8 +1,5 @@ name: Post Pull Request Checks Automation -env: - RUN_ONLY_LATEST_WORKFLOW: 'true' - on: workflow_call: secrets: From bae0624138487a590aae2e362c9a733b97233407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 09:13:24 +0200 Subject: [PATCH 003/128] Setting up for a test. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 072ba679f..a55630ab5 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} if: | - env.RUN_ONLY_LATEST_WORKFLOW == 'false' || github.run_number == needs.get_latest_workflow.outputs.latest_run_number + !(github.run_number == needs.get_latest_workflow.outputs.latest_run_number) steps: - name: Set Merge Token shell: pwsh From 253a6cb1668cf43352ba63580c95463d632e4063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 10:46:12 +0200 Subject: [PATCH 004/128] Optimizing script using Github CLI. --- .../post-pull-request-checks-automation.yml | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index a55630ab5..4844393af 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -45,27 +45,20 @@ on: description: Configuration for the timeout-minutes parameter of the workflow. jobs: - get_latest_workflow: - name: Get the latest workflow run number - runs-on: ubuntu-latest - outputs: - latest_run_number: ${{ steps.get_latest_workflow_run_number.outputs.latest_run_number }} - steps: - - name: Get the latest workflow run number - id: get_latest_workflow_run_number - run: | - LATEST_RUN_NUMBER=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/${{ github.repository }}/actions/runs?event=push" \ - | jq '.workflow_runs[0].run_number') - echo "::set-output name=latest_run_number::$LATEST_RUN_NUMBER" - post-pull-request-checks-automation: + outputs: + latest-run-number: ${{ steps.get-latest-workflow-run-number.outputs.latest_run_number }} runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} if: | - !(github.run_number == needs.get_latest_workflow.outputs.latest_run_number) + github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number steps: + - name: Get Latest Workflow Run Number + id: get-latest-workflow-run-number + run: | + LATEST_RUN_NUMBER=$(gh api repos/${{ github.repository }}/actions/runs?event=push | jq '.workflow_runs[0].run_number') + echo "::set-output name=latest_run_number::$LATEST_RUN_NUMBER" + - name: Set Merge Token shell: pwsh env: From 106206606a61048dfea257b7c800ffe8e99ca4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 10:48:07 +0200 Subject: [PATCH 005/128] Fix bad revert. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 4844393af..fa52f2a69 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -57,7 +57,7 @@ jobs: id: get-latest-workflow-run-number run: | LATEST_RUN_NUMBER=$(gh api repos/${{ github.repository }}/actions/runs?event=push | jq '.workflow_runs[0].run_number') - echo "::set-output name=latest_run_number::$LATEST_RUN_NUMBER" + Set-GitHubOutput -name "latest_run_number" -value "$LATEST_RUN_NUMBER" - name: Set Merge Token shell: pwsh From e58e1c80a03b30cf2547e2df7b9da6c3293bc810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 10:53:52 +0200 Subject: [PATCH 006/128] Fixing the if statement. --- .github/workflows/post-pull-request-checks-automation.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index fa52f2a69..583701732 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -50,8 +50,9 @@ jobs: latest-run-number: ${{ steps.get-latest-workflow-run-number.outputs.latest_run_number }} runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} + needs: get-latest-workflow-run-number if: | - github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number + github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number steps: - name: Get Latest Workflow Run Number id: get-latest-workflow-run-number From bf3347178e855ae553d4b98b6a08e27d626be93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 11:04:50 +0200 Subject: [PATCH 007/128] Adding an input so the function can be optional. --- .github/workflows/post-pull-request-checks-automation.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 583701732..43148d828 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -51,8 +51,12 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} needs: get-latest-workflow-run-number + inputs: + run-only-latest-workflow: + description: 'Run only if the current workflow is the most recent workflow.' + default: 'true' if: | - github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number + (inputs.run-for-latest == 'true') || (github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number) steps: - name: Get Latest Workflow Run Number id: get-latest-workflow-run-number From 33982f9a7749a7542656b5fcade48b6462c693c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 11:12:24 +0200 Subject: [PATCH 008/128] Fixing if. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 43148d828..abd9ee510 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -56,7 +56,7 @@ jobs: description: 'Run only if the current workflow is the most recent workflow.' default: 'true' if: | - (inputs.run-for-latest == 'true') || (github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'true') || (github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number) steps: - name: Get Latest Workflow Run Number id: get-latest-workflow-run-number From 0ce3bb84c59297e3462a9a2f149375640117aa70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 11:21:41 +0200 Subject: [PATCH 009/128] Replacing input. --- .github/workflows/post-pull-request-checks-automation.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index abd9ee510..57700286b 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -43,6 +43,9 @@ on: type: number default: 1 description: Configuration for the timeout-minutes parameter of the workflow. + run-only-latest-workflow: + description: 'Run only if the current workflow is the most recent workflow.' + default: 'true' jobs: post-pull-request-checks-automation: @@ -52,9 +55,6 @@ jobs: timeout-minutes: ${{ inputs.timeout-minutes }} needs: get-latest-workflow-run-number inputs: - run-only-latest-workflow: - description: 'Run only if the current workflow is the most recent workflow.' - default: 'true' if: | (inputs.run-only-latest-workflow == 'true') || (github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number) steps: From 7abf10cc289a8d9b4cf3d56894d0c9cd6c228afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 11:24:28 +0200 Subject: [PATCH 010/128] Fixing check value. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 57700286b..4fe016e28 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -56,7 +56,7 @@ jobs: needs: get-latest-workflow-run-number inputs: if: | - (inputs.run-only-latest-workflow == 'true') || (github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number) steps: - name: Get Latest Workflow Run Number id: get-latest-workflow-run-number From 1044a6676ec9d07ed4c3e628897b301741d545ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 11:25:32 +0200 Subject: [PATCH 011/128] Removing leftover. --- .github/workflows/post-pull-request-checks-automation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 4fe016e28..430bc07a1 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -54,7 +54,6 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} needs: get-latest-workflow-run-number - inputs: if: | (inputs.run-only-latest-workflow == 'false') || (github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number) steps: From 0fc4c9b1a0b98d761b0ac711bbcd03bbfcdd54dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 11:26:51 +0200 Subject: [PATCH 012/128] Adding type. --- .github/workflows/post-pull-request-checks-automation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 430bc07a1..653109549 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -44,6 +44,7 @@ on: default: 1 description: Configuration for the timeout-minutes parameter of the workflow. run-only-latest-workflow: + type: string description: 'Run only if the current workflow is the most recent workflow.' default: 'true' From 95e4ef7a5fdbe1979a8568bb7a9ea87be8f218cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 14:58:18 +0200 Subject: [PATCH 013/128] Optimizing job. --- .../workflows/post-pull-request-checks-automation.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 653109549..005197b86 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -54,9 +54,6 @@ jobs: latest-run-number: ${{ steps.get-latest-workflow-run-number.outputs.latest_run_number }} runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} - needs: get-latest-workflow-run-number - if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_number == needs.get-latest-workflow-run-number.outputs.latest_run_number) steps: - name: Get Latest Workflow Run Number id: get-latest-workflow-run-number @@ -71,6 +68,8 @@ jobs: run: | $mergeToken = $Env:MERGE_TOKEN ? $Env:MERGE_TOKEN : "${{ secrets.GITHUB_TOKEN }}" "MERGE_TOKEN=$mergeToken" >> $Env:GITHUB_ENV + if: | + (inputs.run-only-latest-workflow == 'false') || (github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number) - name: Automatically Merge Pull Request uses: Lombiq/GitHub-Actions/.github/actions/auto-merge-pull-request@dev @@ -78,6 +77,8 @@ jobs: GITHUB_TOKEN: ${{ env.MERGE_TOKEN }} with: merge-method: ${{ inputs.merge-method }} + if: | + (inputs.run-only-latest-workflow == 'false') || (github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number) - name: Automatically Resolve or Done Jira issue uses: Lombiq/GitHub-Actions/.github/actions/auto-resolve-done-jira-issue@dev @@ -86,6 +87,8 @@ jobs: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} + if: | + (inputs.run-only-latest-workflow == 'false') || (github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number) - name: Remove Label # v2.0.0 @@ -94,3 +97,5 @@ jobs: token: ${{ env.MERGE_TOKEN }} labels: merge-and-resolve-jira-issue-if-checks-succeed type: remove + if: | + (inputs.run-only-latest-workflow == 'false') || (github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number) From 827d63ce50d27ff527142745f73338bdcab4e93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 15:27:01 +0200 Subject: [PATCH 014/128] Fixing output syntax. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 005197b86..44d3c01a9 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -59,7 +59,7 @@ jobs: id: get-latest-workflow-run-number run: | LATEST_RUN_NUMBER=$(gh api repos/${{ github.repository }}/actions/runs?event=push | jq '.workflow_runs[0].run_number') - Set-GitHubOutput -name "latest_run_number" -value "$LATEST_RUN_NUMBER" + echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token shell: pwsh From 5be7efac7079883f7b6ab52acea7ea628aded2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 15:48:52 +0200 Subject: [PATCH 015/128] Rewriting script. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 44d3c01a9..c48d07b13 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -58,7 +58,7 @@ jobs: - name: Get Latest Workflow Run Number id: get-latest-workflow-run-number run: | - LATEST_RUN_NUMBER=$(gh api repos/${{ github.repository }}/actions/runs?event=push | jq '.workflow_runs[0].run_number') + LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $1}' | tail -n 1) echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From afa454c6d56bcb335f48c1f1a61c4fa4e83db990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 16:40:28 +0200 Subject: [PATCH 016/128] Using Github Token. --- .github/workflows/post-pull-request-checks-automation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index c48d07b13..5fdf735d1 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -57,6 +57,8 @@ jobs: steps: - name: Get Latest Workflow Run Number id: get-latest-workflow-run-number + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $1}' | tail -n 1) echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From fc0413a6295ff0455c355264234a80ef27de35a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:17:31 +0200 Subject: [PATCH 017/128] Adding checkout. --- .github/workflows/post-pull-request-checks-automation.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 5fdf735d1..5eaa0484a 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -55,6 +55,11 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: + - name: Checkout + uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Get Latest Workflow Run Number id: get-latest-workflow-run-number env: From 485bcde19babc58be52d6af5f9776c0520225bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:38:01 +0200 Subject: [PATCH 018/128] Adding test line. --- .github/workflows/post-pull-request-checks-automation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 5eaa0484a..99e04ba64 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -66,6 +66,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $1}' | tail -n 1) + echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From 4b2aff588723206abc1170ec851985692ca7b416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:40:36 +0200 Subject: [PATCH 019/128] Fixing Latest run number. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 99e04ba64..0e8d51ab5 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -65,7 +65,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $1}' | tail -n 1) + LATEST_RUN_NUMBER=$(gh run list --limit 1 | jq '.[0].run_number') echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 6660ce8c76c66f4284d916f4bb04a77ee98afee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:43:41 +0200 Subject: [PATCH 020/128] Testing output. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 0e8d51ab5..23bbe03cd 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -65,7 +65,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | jq '.[0].run_number') + LATEST_RUN_NUMBER=$(gh run list) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From e07b22bece3cf13bf49326b3361f4c913a24671f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:48:53 +0200 Subject: [PATCH 021/128] Fix. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 23bbe03cd..66c29e138 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -65,7 +65,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list) + LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $6}' | tail -n 1) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 1e7fa530433102cbdd473d9d48f1f6c1e34dbb75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:53:46 +0200 Subject: [PATCH 022/128] Fix. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 66c29e138..863df96be 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -65,7 +65,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $6}' | tail -n 1) + LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $25}' | tail -n 1) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From f68aa7831ad45645aa5a3dc0a55f376f64118a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:55:30 +0200 Subject: [PATCH 023/128] Adjusting number. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 863df96be..c6aff7345 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -65,7 +65,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $25}' | tail -n 1) + LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $24}' | tail -n 1) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 215c52d5d716a5817d756b2f7284a6b7282dd54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:57:19 +0200 Subject: [PATCH 024/128] Checking output. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index c6aff7345..f2bf31e38 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -65,7 +65,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $24}' | tail -n 1) + LATEST_RUN_NUMBER=$(gh run list --limit 1) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 41927a3020bb5ec3a86afdb577a78981bd66550f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 17:59:50 +0200 Subject: [PATCH 025/128] Checking output. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index f2bf31e38..aa6c42017 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -65,7 +65,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1) + LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $20}') echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From ce83e789d7f24158f90b0a06a4108e6ab9bee6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 18:02:47 +0200 Subject: [PATCH 026/128] Checking output. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index aa6c42017..084f322c0 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -65,7 +65,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $20}') + LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $26}') echo "latest_run_number=$LATEST_RUN_NUMBER" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 138b90a91ebe92404c7f484ebf8af65e53546b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 18:05:42 +0200 Subject: [PATCH 027/128] Checking output. --- .github/workflows/post-pull-request-checks-automation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 084f322c0..7747ac7e7 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -67,6 +67,7 @@ jobs: run: | LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $26}') echo "latest_run_number=$LATEST_RUN_NUMBER" + echo "github.run_number=${{ github.run_number }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From 096e4147138dd970857a7b726badb419e48bad45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 18:10:30 +0200 Subject: [PATCH 028/128] Checking output. --- .github/workflows/post-pull-request-checks-automation.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 7747ac7e7..9b4adc31c 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -67,7 +67,8 @@ jobs: run: | LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $26}') echo "latest_run_number=$LATEST_RUN_NUMBER" - echo "github.run_number=${{ github.run_number }}" + echo "github.run_number=${{ github.run_id }}" + echo "output=${{ outputs.latest-run-number }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From 8f5ad30d916e20bfcd3b923c19a52bef3217d2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 18:13:42 +0200 Subject: [PATCH 029/128] Checking output. --- .github/workflows/post-pull-request-checks-automation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 9b4adc31c..ba626c22b 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -68,7 +68,6 @@ jobs: LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $26}') echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" - echo "output=${{ outputs.latest-run-number }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From c848049d60faf96296d9d452965fd8bec7231fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 18:24:53 +0200 Subject: [PATCH 030/128] Using id. --- .../workflows/post-pull-request-checks-automation.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index ba626c22b..9c2244f20 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -66,8 +66,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $26}') - echo "latest_run_number=$LATEST_RUN_NUMBER" - echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token @@ -78,7 +76,7 @@ jobs: $mergeToken = $Env:MERGE_TOKEN ? $Env:MERGE_TOKEN : "${{ secrets.GITHUB_TOKEN }}" "MERGE_TOKEN=$mergeToken" >> $Env:GITHUB_ENV if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest_run_number) - name: Automatically Merge Pull Request uses: Lombiq/GitHub-Actions/.github/actions/auto-merge-pull-request@dev @@ -87,7 +85,7 @@ jobs: with: merge-method: ${{ inputs.merge-method }} if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest_run_number) - name: Automatically Resolve or Done Jira issue uses: Lombiq/GitHub-Actions/.github/actions/auto-resolve-done-jira-issue@dev @@ -97,7 +95,7 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest_run_number) - name: Remove Label # v2.0.0 @@ -107,4 +105,4 @@ jobs: labels: merge-and-resolve-jira-issue-if-checks-succeed type: remove if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_number == steps.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest_run_number) From 93d290bc9d2ba4ca00458c62ed3a94f31232a412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 18:37:59 +0200 Subject: [PATCH 031/128] Test. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 9c2244f20..0ca1c191d 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -46,7 +46,7 @@ on: run-only-latest-workflow: type: string description: 'Run only if the current workflow is the most recent workflow.' - default: 'true' + default: 'false' jobs: post-pull-request-checks-automation: From 010057f6a8511d62a0399aaf8d4922ea235012f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 18:41:45 +0200 Subject: [PATCH 032/128] Test. --- .github/workflows/post-pull-request-checks-automation.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 46c8d6bc4..fd580d8c2 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -43,7 +43,7 @@ on: run-only-latest-workflow: type: string description: 'Run only if the current workflow is the most recent workflow.' - default: 'false' + default: 'true' jobs: post-pull-request-checks-automation: @@ -63,6 +63,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $26}') + echo "latest_run_number=$LATEST_RUN_NUMBER" + echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From 1b7dc31eaf7c22552712cbe1475e43f6025796f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 21:23:08 +0200 Subject: [PATCH 033/128] Altering script. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index fd580d8c2..d456fb70e 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | awk '{print $26}') + LATEST_RUN_NUMBER=$(gh run view --json id --jq '.id') echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 448651ba46a75044d889e49ab81c3c2747c889c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Jul 2023 21:54:16 +0200 Subject: [PATCH 034/128] Test. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index d456fb70e..e15ea3549 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run view --json id --jq '.id') + LATEST_RUN_NUMBER=$(gh run list) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 7871ec714a248397274f9d0ad95b94df341c1234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 09:26:56 +0200 Subject: [PATCH 035/128] Trying out JQ. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index e15ea3549..f6403ead7 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list) + LATEST_RUN_NUMBER=$(gh run list --limit 1 | jq -r .[0]) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 099297509701e541b157f4d4c82c0159c79ad015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 09:28:37 +0200 Subject: [PATCH 036/128] Trying out JQ. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index f6403ead7..fc12a17f6 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | jq -r .[0]) + LATEST_RUN_NUMBER=$(gh run list --limit 1 | jq -r .[0].id) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From 751597e3ed018a74a293422df8bdbe689887181f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 09:36:16 +0200 Subject: [PATCH 037/128] Fix. --- .github/workflows/post-pull-request-checks-automation.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index fc12a17f6..17059fc6b 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,9 +62,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | jq -r .[0].id) + LATEST_RUN_NUMBER=$(gh run list --limit 1 | grep -o '"id": [0-9]*' | awk '{print $2}') echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" + echo "See the real output=${{ latest-run-number }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From 512beca800cca805167d38afdd04d688f1329cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 09:41:18 +0200 Subject: [PATCH 038/128] --json flag. --- .github/workflows/post-pull-request-checks-automation.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 17059fc6b..66f1375a5 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,10 +62,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 | grep -o '"id": [0-9]*' | awk '{print $2}') + LATEST_RUN_NUMBER=$(gh run list --limit 1 --json) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" - echo "See the real output=${{ latest-run-number }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From 74a08a11c62085ffba5db1978159ae822f91a94d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 09:44:58 +0200 Subject: [PATCH 039/128] Checking fields. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 66f1375a5..57b76a6b7 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 --json) + LATEST_RUN_NUMBER=$(gh run list --limit 1 --json number,workflowDatabaseId) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From c879a96e343b884bef036dab6c96a82295f8d714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 09:48:31 +0200 Subject: [PATCH 040/128] Checking fields. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 57b76a6b7..2f22d27c3 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 --json number,workflowDatabaseId) + LATEST_RUN_NUMBER=$(gh run list --limit 1 --json number,databaseId) echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From be119a4a180a30c6bf0607c7528ad1d88c5a6eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 09:55:17 +0200 Subject: [PATCH 041/128] Checking fields. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 2f22d27c3..e80e9cc96 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 --json number,databaseId) + LATEST_RUN_NUMBER=$(gh run list --limit 1 --json databaseId | jq -r '.databaseId') echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From dd133bc62c1fae1d75ac3073fbe9618ab3f10150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 09:57:43 +0200 Subject: [PATCH 042/128] Fix. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index e80e9cc96..f5220c8e2 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 --json databaseId | jq -r '.databaseId') + LATEST_RUN_NUMBER=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') echo "latest_run_number=$LATEST_RUN_NUMBER" echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT From d9e1baec27e178cddd729ede6299598e0db454cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 29 Jul 2023 10:00:45 +0200 Subject: [PATCH 043/128] Removing testing loggers. --- .github/workflows/post-pull-request-checks-automation.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index f5220c8e2..95c8fbc57 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -63,8 +63,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | LATEST_RUN_NUMBER=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - echo "latest_run_number=$LATEST_RUN_NUMBER" - echo "github.run_number=${{ github.run_id }}" echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT - name: Set Merge Token From 964bb4aae4338816e988972efe5f9459bcc1d16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= <92299130+Psichorex@users.noreply.github.com> Date: Sun, 30 Jul 2023 17:19:56 +0200 Subject: [PATCH 044/128] Update .github/workflows/post-pull-request-checks-automation.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 95c8fbc57..8a6d9cc43 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -42,7 +42,7 @@ on: description: Configuration for the timeout-minutes parameter of the workflow. run-only-latest-workflow: type: string - description: 'Run only if the current workflow is the most recent workflow.' + description: Run only if the current workflow is the most recent workflow. default: 'true' jobs: From 7e4d89091f95122ba83ed00dfb7c46d208e5f279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= <92299130+Psichorex@users.noreply.github.com> Date: Sun, 30 Jul 2023 17:20:03 +0200 Subject: [PATCH 045/128] Update .github/workflows/post-pull-request-checks-automation.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 8a6d9cc43..864ef8524 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -43,7 +43,7 @@ on: run-only-latest-workflow: type: string description: Run only if the current workflow is the most recent workflow. - default: 'true' + default: true jobs: post-pull-request-checks-automation: From b3eca494a3a6adfd22a6d7b0ff6f638ad5a3b603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 30 Jul 2023 17:24:26 +0200 Subject: [PATCH 046/128] Removing output. --- .github/workflows/post-pull-request-checks-automation.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 95c8fbc57..03a1a6ed6 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -47,8 +47,6 @@ on: jobs: post-pull-request-checks-automation: - outputs: - latest-run-number: ${{ steps.get-latest-workflow-run-number.outputs.latest_run_number }} runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: From 4a11fbbaf64c488e39c17f5f2687afa2eeb91312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 30 Jul 2023 17:32:24 +0200 Subject: [PATCH 047/128] Testing. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index f490ae4f2..36d743992 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -43,7 +43,7 @@ on: run-only-latest-workflow: type: string description: Run only if the current workflow is the most recent workflow. - default: true + default: false jobs: post-pull-request-checks-automation: From b2504a2114b6f74da73e6f47518279232f245375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 30 Jul 2023 17:42:22 +0200 Subject: [PATCH 048/128] Testing --- .../workflows/post-pull-request-checks-automation.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 36d743992..cefef8467 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -43,7 +43,7 @@ on: run-only-latest-workflow: type: string description: Run only if the current workflow is the most recent workflow. - default: false + default: true jobs: post-pull-request-checks-automation: @@ -56,12 +56,13 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Get Latest Workflow Run Number + shell: pwsh id: get-latest-workflow-run-number env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | LATEST_RUN_NUMBER=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - echo "latest_run_number=$LATEST_RUN_NUMBER" >> $GITHUB_OUTPUT + Set-GitHubOutput 'latest-run-number' $LATEST_RUN_NUMBER - name: Set Merge Token shell: pwsh @@ -71,7 +72,7 @@ jobs: $mergeToken = $Env:MERGE_TOKEN ? $Env:MERGE_TOKEN : "${{ secrets.GITHUB_TOKEN }}" "MERGE_TOKEN=$mergeToken" >> $Env:GITHUB_ENV if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest-run-number) - name: Automatically Merge Pull Request uses: Lombiq/GitHub-Actions/.github/actions/auto-merge-pull-request@dev @@ -80,7 +81,7 @@ jobs: with: merge-method: ${{ inputs.merge-method }} if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest-run-number) - name: Automatically Resolve or Done Jira issue uses: Lombiq/GitHub-Actions/.github/actions/auto-resolve-done-jira-issue@dev @@ -90,7 +91,7 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest-run-number) - name: Remove Label # v2.0.0 From 4a0afeeba29aa75f6acc87b7ae8ef931bc6ed4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 30 Jul 2023 17:48:25 +0200 Subject: [PATCH 049/128] Testing --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index cefef8467..d4914ec02 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -61,7 +61,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_RUN_NUMBER=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') + $latestRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') Set-GitHubOutput 'latest-run-number' $LATEST_RUN_NUMBER - name: Set Merge Token From 3dafca76711bbde091abc4bc20c51b6c83ba3a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 30 Jul 2023 17:53:24 +0200 Subject: [PATCH 050/128] Testing --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index d4914ec02..3cd3e9015 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $latestRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - Set-GitHubOutput 'latest-run-number' $LATEST_RUN_NUMBER + Set-GitHubOutput -Key 'latest-run-number' -Value $LATEST_RUN_NUMBER - name: Set Merge Token shell: pwsh From 97ddc951bc5654af0802677414f51c26c55c4886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 30 Jul 2023 17:53:46 +0200 Subject: [PATCH 051/128] Testing --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 3cd3e9015..e12d8edfe 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -62,7 +62,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $latestRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - Set-GitHubOutput -Key 'latest-run-number' -Value $LATEST_RUN_NUMBER + Set-GitHubOutput -Key 'latest-run-number' -Value $latestRunNumber - name: Set Merge Token shell: pwsh From 4ee75a030c3f2a0b3f0665ebcf5ed5d9766f5752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 30 Jul 2023 17:58:29 +0200 Subject: [PATCH 052/128] Testing --- .github/workflows/post-pull-request-checks-automation.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index e12d8edfe..71e3bcfbf 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -58,8 +58,6 @@ jobs: - name: Get Latest Workflow Run Number shell: pwsh id: get-latest-workflow-run-number - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $latestRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') Set-GitHubOutput -Key 'latest-run-number' -Value $latestRunNumber From 4dc0222218d158c9462683a195875230083aef63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 30 Jul 2023 18:00:45 +0200 Subject: [PATCH 053/128] Do we need checkout? --- .github/workflows/post-pull-request-checks-automation.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 71e3bcfbf..b548ee91a 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -50,14 +50,11 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: - - name: Checkout - uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Get Latest Workflow Run Number shell: pwsh id: get-latest-workflow-run-number + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $latestRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') Set-GitHubOutput -Key 'latest-run-number' -Value $latestRunNumber From 4d8cbefe5e3f0cdec4bd92d0ecc61a52b201c2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:24:08 +0200 Subject: [PATCH 054/128] Adding composite action. --- .../action.yml | 0 .../actions/check-latest-workflow/action.yml | 25 +++++++++++++++++++ .../post-pull-request-checks-automation.yml | 6 ++--- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 .github/actions/check-current-workflow-is-latest/action.yml create mode 100644 .github/actions/check-latest-workflow/action.yml diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml new file mode 100644 index 000000000..678d6465e --- /dev/null +++ b/.github/actions/check-latest-workflow/action.yml @@ -0,0 +1,25 @@ +name: Check current workflow is the latest workflow +description: Checks whether the current workflow is the most recent workflow. + +outputs: + latest-workflow-run-id: + description: The latest workflow run's database id. + value: ${{ steps.get-latest-workflow-run-id.outputs.latest-workflow-run-id }} + +runs: + using: "composite" + steps: + - name: Setup Scripts + shell: pwsh + run: | + "${{ github.action_path }}" >> $Env:GITHUB_PATH + (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH + + - name: Get Latest Workflow Run Number + shell: pwsh + id: get-latest-workflow-run-id + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') + Set-GitHubOutput -Key 'latest-workflow-run-id' -Value $latestWorkflowRunNumber diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index b548ee91a..b8b60299c 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -51,13 +51,11 @@ jobs: timeout-minutes: ${{ inputs.timeout-minutes }} steps: - name: Get Latest Workflow Run Number - shell: pwsh + uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 id: get-latest-workflow-run-number env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - $latestRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - Set-GitHubOutput -Key 'latest-run-number' -Value $latestRunNumber + - name: Set Merge Token shell: pwsh From ef5519bc9e4555505b7dc7184f6702588126ea80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:24:36 +0200 Subject: [PATCH 055/128] Removing empty line. --- .github/workflows/post-pull-request-checks-automation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index b8b60299c..29732eebe 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -55,7 +55,6 @@ jobs: id: get-latest-workflow-run-number env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Set Merge Token shell: pwsh From d6f9eb0e36eec456cfc145f7d4a4cb364c62c7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:27:58 +0200 Subject: [PATCH 056/128] Adding input. --- .github/actions/check-latest-workflow/action.yml | 6 ++++++ .github/workflows/post-pull-request-checks-automation.yml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml index 678d6465e..c2a7bf3a2 100644 --- a/.github/actions/check-latest-workflow/action.yml +++ b/.github/actions/check-latest-workflow/action.yml @@ -1,6 +1,12 @@ name: Check current workflow is the latest workflow description: Checks whether the current workflow is the most recent workflow. +inputs: + current-workflow-id: + description: The current workflow run's database id. + required: "true" + default: '' + outputs: latest-workflow-run-id: description: The latest workflow run's database id. diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 29732eebe..1f334b3ec 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -55,6 +55,8 @@ jobs: id: get-latest-workflow-run-number env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + current-workflow-id: ${{ github.run_id }} - name: Set Merge Token shell: pwsh From f14e6f95ff28ceeb7eff5c9b738d0b1f5f4001fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:32:47 +0200 Subject: [PATCH 057/128] Returning boolean. --- .github/actions/check-latest-workflow/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml index c2a7bf3a2..ca31e57d1 100644 --- a/.github/actions/check-latest-workflow/action.yml +++ b/.github/actions/check-latest-workflow/action.yml @@ -28,4 +28,4 @@ runs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - Set-GitHubOutput -Key 'latest-workflow-run-id' -Value $latestWorkflowRunNumber + Set-GitHubOutput -Key 'should-run' -Value ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) From 1a8b69732b046a568b4ebb0d70ced5db4d6c7ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:33:39 +0200 Subject: [PATCH 058/128] Fixing name. --- .github/actions/check-latest-workflow/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml index ca31e57d1..f65d06974 100644 --- a/.github/actions/check-latest-workflow/action.yml +++ b/.github/actions/check-latest-workflow/action.yml @@ -10,7 +10,7 @@ inputs: outputs: latest-workflow-run-id: description: The latest workflow run's database id. - value: ${{ steps.get-latest-workflow-run-id.outputs.latest-workflow-run-id }} + value: ${{ steps.get-latest-workflow-run-id.outputs.should-run }} runs: using: "composite" From 4ba49fc48a8533114b35e001baba84999033d9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:35:22 +0200 Subject: [PATCH 059/128] Fix. --- .github/actions/check-latest-workflow/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml index f65d06974..d62c8cf03 100644 --- a/.github/actions/check-latest-workflow/action.yml +++ b/.github/actions/check-latest-workflow/action.yml @@ -5,7 +5,7 @@ inputs: current-workflow-id: description: The current workflow run's database id. required: "true" - default: '' + default: "" outputs: latest-workflow-run-id: From bd8801e6d705fd329f7f816cb0efd2416fb8eefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:41:19 +0200 Subject: [PATCH 060/128] Fix. --- .github/actions/check-latest-workflow/action.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml index d62c8cf03..aacbcdc57 100644 --- a/.github/actions/check-latest-workflow/action.yml +++ b/.github/actions/check-latest-workflow/action.yml @@ -4,7 +4,7 @@ description: Checks whether the current workflow is the most recent workflow. inputs: current-workflow-id: description: The current workflow run's database id. - required: "true" + required: true default: "" outputs: @@ -21,9 +21,8 @@ runs: "${{ github.action_path }}" >> $Env:GITHUB_PATH (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH - - name: Get Latest Workflow Run Number - shell: pwsh - id: get-latest-workflow-run-id + - name: Check Current Workflow Equals Latest + id: check-current-workflow-equals-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | From b0034d6566f3e112ead86094563bf65763a8d102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:46:14 +0200 Subject: [PATCH 061/128] Fixing folder and workflow. --- .../action.yml | 30 +++++++++++++++++++ .../actions/check-latest-workflow/action.yml | 2 +- .../post-pull-request-checks-automation.yml | 10 +++---- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index e69de29bb..e58cfa14a 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -0,0 +1,30 @@ +name: Check current workflow is the latest workflow +description: Checks whether the current workflow is the most recent workflow. + +inputs: + current-workflow-id: + description: The current workflow run's database id. + required: true + default: "" + +outputs: + latest-workflow-run-id: + description: The latest workflow run's database id. + value: ${{ steps.check-current-workflow-equals-latest.outputs.should-run }} + +runs: + using: "composite" + steps: + - name: Setup Scripts + shell: pwsh + run: | + "${{ github.action_path }}" >> $Env:GITHUB_PATH + (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH + + - name: Check Current Workflow Equals Latest + id: check-current-workflow-equals-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') + Set-GitHubOutput -Key 'should-run' -Value ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml index aacbcdc57..e58cfa14a 100644 --- a/.github/actions/check-latest-workflow/action.yml +++ b/.github/actions/check-latest-workflow/action.yml @@ -10,7 +10,7 @@ inputs: outputs: latest-workflow-run-id: description: The latest workflow run's database id. - value: ${{ steps.get-latest-workflow-run-id.outputs.should-run }} + value: ${{ steps.check-current-workflow-equals-latest.outputs.should-run }} runs: using: "composite" diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 1f334b3ec..6d1610cb1 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -52,7 +52,7 @@ jobs: steps: - name: Get Latest Workflow Run Number uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 - id: get-latest-workflow-run-number + id: check-steps-should-run env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -66,7 +66,7 @@ jobs: $mergeToken = $Env:MERGE_TOKEN ? $Env:MERGE_TOKEN : "${{ secrets.GITHUB_TOKEN }}" "MERGE_TOKEN=$mergeToken" >> $Env:GITHUB_ENV if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest-run-number) + (inputs.run-only-latest-workflow == 'false') || (steps.check-steps-should-run.outputs.should-run) - name: Automatically Merge Pull Request uses: Lombiq/GitHub-Actions/.github/actions/auto-merge-pull-request@dev @@ -75,7 +75,7 @@ jobs: with: merge-method: ${{ inputs.merge-method }} if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest-run-number) + (inputs.run-only-latest-workflow == 'false') || (steps.check-steps-should-run.outputs.should-run) - name: Automatically Resolve or Done Jira issue uses: Lombiq/GitHub-Actions/.github/actions/auto-resolve-done-jira-issue@dev @@ -85,7 +85,7 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest-run-number) + (inputs.run-only-latest-workflow == 'false') || (steps.check-steps-should-run.outputs.should-run) - name: Remove Label # v2.0.0 @@ -95,4 +95,4 @@ jobs: labels: merge-and-resolve-jira-issue-if-checks-succeed type: remove if: | - (inputs.run-only-latest-workflow == 'false') || (github.run_id == steps.get-latest-workflow-run-number.outputs.latest_run_number) + (inputs.run-only-latest-workflow == 'false') || (steps.check-steps-should-run.outputs.should-run) From 64fba551c890690ab2377278612c9a48d1de8815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:48:32 +0200 Subject: [PATCH 062/128] Fixing errors. --- .github/actions/check-latest-workflow/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml index e58cfa14a..2f7008b1d 100644 --- a/.github/actions/check-latest-workflow/action.yml +++ b/.github/actions/check-latest-workflow/action.yml @@ -22,9 +22,8 @@ runs: (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH - name: Check Current Workflow Equals Latest + shell: pwsh id: check-current-workflow-equals-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') Set-GitHubOutput -Key 'should-run' -Value ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) From bec282f04ba3661b56e873fa090bc2a4d06123ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:50:11 +0200 Subject: [PATCH 063/128] Folder structure fix. --- .../action.yml | 3 +- .../actions/check-latest-workflow/action.yml | 29 ------------------- 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 .github/actions/check-latest-workflow/action.yml diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index e58cfa14a..2f7008b1d 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -22,9 +22,8 @@ runs: (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH - name: Check Current Workflow Equals Latest + shell: pwsh id: check-current-workflow-equals-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') Set-GitHubOutput -Key 'should-run' -Value ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) diff --git a/.github/actions/check-latest-workflow/action.yml b/.github/actions/check-latest-workflow/action.yml deleted file mode 100644 index 2f7008b1d..000000000 --- a/.github/actions/check-latest-workflow/action.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Check current workflow is the latest workflow -description: Checks whether the current workflow is the most recent workflow. - -inputs: - current-workflow-id: - description: The current workflow run's database id. - required: true - default: "" - -outputs: - latest-workflow-run-id: - description: The latest workflow run's database id. - value: ${{ steps.check-current-workflow-equals-latest.outputs.should-run }} - -runs: - using: "composite" - steps: - - name: Setup Scripts - shell: pwsh - run: | - "${{ github.action_path }}" >> $Env:GITHUB_PATH - (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH - - - name: Check Current Workflow Equals Latest - shell: pwsh - id: check-current-workflow-equals-latest - run: | - $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - Set-GitHubOutput -Key 'should-run' -Value ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) From 279a8b4238b26129835d4021d1a6d0fb41899e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:52:23 +0200 Subject: [PATCH 064/128] Naming. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 6d1610cb1..df02ec2d6 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -50,7 +50,7 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: - - name: Get Latest Workflow Run Number + - name: Check Further Steps Should Run uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 id: check-steps-should-run env: From 1ee079ba1af34875a433588fa2613713e61746db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:53:59 +0200 Subject: [PATCH 065/128] Testing with false. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index df02ec2d6..4c16b71ef 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -43,7 +43,7 @@ on: run-only-latest-workflow: type: string description: Run only if the current workflow is the most recent workflow. - default: true + default: false jobs: post-pull-request-checks-automation: From eec6cf575887d8b99b79d81c74ade49b0afcc34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:55:32 +0200 Subject: [PATCH 066/128] It works with false. Revert. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 4c16b71ef..df02ec2d6 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -43,7 +43,7 @@ on: run-only-latest-workflow: type: string description: Run only if the current workflow is the most recent workflow. - default: false + default: true jobs: post-pull-request-checks-automation: From f90b430850eec0382cccbc3b9028612f0ce04fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 09:59:25 +0200 Subject: [PATCH 067/128] Printing output. --- .github/workflows/post-pull-request-checks-automation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index df02ec2d6..5657e6981 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -57,6 +57,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: current-workflow-id: ${{ github.run_id }} + run: | + echo "Result=${{ steps.check-steps-should-run.outputs.should-run }}" - name: Set Merge Token shell: pwsh From 6270a24c181cfd8805c7d57cc1f7219a7f908e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 10:06:01 +0200 Subject: [PATCH 068/128] Testing. --- .github/actions/check-current-workflow-is-latest/action.yml | 4 +++- .github/workflows/post-pull-request-checks-automation.yml | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 2f7008b1d..30f8ce00e 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,4 +26,6 @@ runs: id: check-current-workflow-equals-latest run: | $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - Set-GitHubOutput -Key 'should-run' -Value ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) + echo "Latest Workflow Run Number: $latestWorkflowRunNumber" + $currentEqualsLatest= ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) + Set-GitHubOutput -Key 'should-run' -Value $currentEqualsLatest diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 5657e6981..df02ec2d6 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -57,8 +57,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: current-workflow-id: ${{ github.run_id }} - run: | - echo "Result=${{ steps.check-steps-should-run.outputs.should-run }}" - name: Set Merge Token shell: pwsh From 7b9939966af650c3d70ab3adb8feaeeb05bd2e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 10:10:52 +0200 Subject: [PATCH 069/128] Checkout? --- .github/workflows/post-pull-request-checks-automation.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index df02ec2d6..80273c107 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -50,6 +50,11 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: + - name: Checkout + uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Check Further Steps Should Run uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 id: check-steps-should-run From d55ed505165ac515f41f1f610e46b434586fa956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 10:13:30 +0200 Subject: [PATCH 070/128] Fix output name. --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 30f8ce00e..13b856981 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -8,7 +8,7 @@ inputs: default: "" outputs: - latest-workflow-run-id: + should-run: description: The latest workflow run's database id. value: ${{ steps.check-current-workflow-equals-latest.outputs.should-run }} From 0a7395f81a6f3523cee9523022c6ec4c43c0b03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 10:15:14 +0200 Subject: [PATCH 071/128] Remove Checkout. --- .github/actions/check-current-workflow-is-latest/action.yml | 1 - .github/workflows/post-pull-request-checks-automation.yml | 5 ----- 2 files changed, 6 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 13b856981..551c58925 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,5 @@ runs: id: check-current-workflow-equals-latest run: | $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - echo "Latest Workflow Run Number: $latestWorkflowRunNumber" $currentEqualsLatest= ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput -Key 'should-run' -Value $currentEqualsLatest diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 80273c107..df02ec2d6 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -50,11 +50,6 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: - - name: Checkout - uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Check Further Steps Should Run uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 id: check-steps-should-run From bb4df5d0f1e38e9b674d86461f1bf5cb6864f55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 31 Jul 2023 10:23:11 +0200 Subject: [PATCH 072/128] Optimizing if. --- .github/workflows/post-pull-request-checks-automation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index df02ec2d6..d27c1dc71 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -57,6 +57,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: current-workflow-id: ${{ github.run_id }} + if: inputs.run-only-latest-workflow == 'true' - name: Set Merge Token shell: pwsh From 708a87d5d146ba0bb73c7b2753e5a117106a1ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= <92299130+Psichorex@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:47:55 +0200 Subject: [PATCH 073/128] Update .github/actions/check-current-workflow-is-latest/action.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 551c58925..ff2ea00d3 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,5 +26,5 @@ runs: id: check-current-workflow-equals-latest run: | $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - $currentEqualsLatest= ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) + $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput -Key 'should-run' -Value $currentEqualsLatest From f991f08bf2a40c35a692944916e282877629f8df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= <92299130+Psichorex@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:48:34 +0200 Subject: [PATCH 074/128] Update .github/actions/check-current-workflow-is-latest/action.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index ff2ea00d3..4f564872d 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,4 +27,4 @@ runs: run: | $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) - Set-GitHubOutput -Key 'should-run' -Value $currentEqualsLatest + Set-GitHubOutput 'should-run' $currentEqualsLatest From 60281e7a9a01ca3b6a793230c6ca94d77575da6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= <92299130+Psichorex@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:48:43 +0200 Subject: [PATCH 075/128] Update .github/actions/check-current-workflow-is-latest/action.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 4f564872d..242844b57 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -25,6 +25,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunNumber=$(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') + $latestWorkflowRunNumber = $(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From 2370a28b208474f80016fc5608fb412cb15a2f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 13:29:11 +0200 Subject: [PATCH 076/128] Trying to access only the current PR. --- .../check-current-workflow-is-latest/action.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 242844b57..8828ed7f3 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -1,5 +1,6 @@ -name: Check current workflow is the latest workflow -description: Checks whether the current workflow is the most recent workflow. +# Intentionally not documented in Actions.md since it's only meant for internal use +name: Check Current Workflow Is The Latest Workflow +description: Checks whether the current workflow is the most recent workflow for the pull request. inputs: current-workflow-id: @@ -25,6 +26,10 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunNumber = $(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') + $prNumber = $(gh pr view --json number -q ".number") + echo "TEST=$prNumber" + $testVar = $(gh run list --pr $prNumber --limit 1) + echo "TEST2=$testVar" + $latestWorkflowRunNumber = $(gh run list --pr $prNumber --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From baf88aa42f5127a7f11b533413ed5a13b7596368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 13:35:34 +0200 Subject: [PATCH 077/128] Temp removal for testing. --- .../actions/check-current-workflow-is-latest/action.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 8828ed7f3..dff159f32 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,10 +26,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $prNumber = $(gh pr view --json number -q ".number") + $prNumber = $(gh pr view) echo "TEST=$prNumber" - $testVar = $(gh run list --pr $prNumber --limit 1) - echo "TEST2=$testVar" - $latestWorkflowRunNumber = $(gh run list --pr $prNumber --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId - $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) - Set-GitHubOutput 'should-run' $currentEqualsLatest + From 934973303cd76e01aab896f484fcbb5dffc00de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 13:35:47 +0200 Subject: [PATCH 078/128] Fix. --- .github/actions/check-current-workflow-is-latest/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index dff159f32..390e61037 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -28,4 +28,3 @@ runs: run: | $prNumber = $(gh pr view) echo "TEST=$prNumber" - From 22bb28496df1fe1837ff225fb2498ef4f0a4e22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 13:37:35 +0200 Subject: [PATCH 079/128] Fix. --- .github/actions/check-current-workflow-is-latest/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 390e61037..a26aacf42 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,5 +26,4 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $prNumber = $(gh pr view) - echo "TEST=$prNumber" + echo ${{ gh pr view }} From 06f8e420eaad9e8fedc0c0006247023751ab143b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 13:52:49 +0200 Subject: [PATCH 080/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index a26aacf42..59ed1dd8c 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,4 +26,5 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - echo ${{ gh pr view }} + $currentPr = $(gh pr view) + echo "TEST=$currentPr" From 07ccc86d1a5924b434edf2308b74ce0be5c554f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 13:54:42 +0200 Subject: [PATCH 081/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 59ed1dd8c..aa4be96b8 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,5 +26,5 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $currentPr = $(gh pr view) + $currentPr = $(gh run list) echo "TEST=$currentPr" From 33deb6b563d98212d5e971da8f8bdf5a0bc6474c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 14:10:23 +0200 Subject: [PATCH 082/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index aa4be96b8..6803632a5 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,5 +26,7 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $currentPr = $(gh run list) - echo "TEST=$currentPr" + $latestWorkflowRunNumber = $(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') + echo "TEST=$latestWorkflowRunNumber" + $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) + Set-GitHubOutput 'should-run' $currentEqualsLatest From e797b61e95ef86c0c2b94f1f6be1d0573c006dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 14:12:00 +0200 Subject: [PATCH 083/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 6803632a5..5564eb3a3 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,6 +27,6 @@ runs: id: check-current-workflow-equals-latest run: | $latestWorkflowRunNumber = $(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - echo "TEST=$latestWorkflowRunNumber" + echo "TEST=${{ $latestWorkflowRunNumber }}" $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From 7088f2331ebcddcefa77dcb2f6f766e7c61a0719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 14:16:52 +0200 Subject: [PATCH 084/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 5564eb3a3..9dc2e764e 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,6 +27,6 @@ runs: id: check-current-workflow-equals-latest run: | $latestWorkflowRunNumber = $(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - echo "TEST=${{ $latestWorkflowRunNumber }}" + echo "TEST = $latestWorkflowRunNumber" $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From 7d42426266acc25da1a41ba4b8126a09be492f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 14:44:47 +0200 Subject: [PATCH 085/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 9dc2e764e..4e69ba773 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,7 +26,7 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunNumber = $(gh run list --limit 1 --json databaseId | jq -r '.[0].databaseId') - echo "TEST = $latestWorkflowRunNumber" + $currentBranch=${{ github.head_ref }} + $latestWorkflowRunNumber = $(gh run list --branch $currentBranch --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From 32521590b840254f9de5a1a994e272c08f8bb03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 14:47:35 +0200 Subject: [PATCH 086/128] Shortening. --- .github/actions/check-current-workflow-is-latest/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 4e69ba773..53217f74e 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,7 +26,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $currentBranch=${{ github.head_ref }} - $latestWorkflowRunNumber = $(gh run list --branch $currentBranch --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunNumber = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From c1fee6123ba90649eee5f25fe0ab58c935706123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 14:52:28 +0200 Subject: [PATCH 087/128] Test. --- .github/actions/check-current-workflow-is-latest/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 53217f74e..03f1054fa 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,7 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunNumber = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $currentBranch=${{ github.head_ref }} + $latestWorkflowRunNumber = $(gh run list --branch "$currentBranch" --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From bbd584cd0f16764bdecd1a3c430c397a830a1d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 14:55:14 +0200 Subject: [PATCH 088/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 03f1054fa..fc67ba9a7 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -25,8 +25,9 @@ runs: - name: Check Current Workflow Equals Latest shell: pwsh id: check-current-workflow-equals-latest + env: + CURRENT_BRANCH: ${{ github.head_ref }} run: | - $currentBranch=${{ github.head_ref }} - $latestWorkflowRunNumber = $(gh run list --branch "$currentBranch" --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunNumber = $(gh run list --branch "$CURRENT_BRANCH" --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From a206262a3d81538a5a63ab8bbb308628dad9a4af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 14:58:58 +0200 Subject: [PATCH 089/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index fc67ba9a7..8e6738ed8 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -25,9 +25,8 @@ runs: - name: Check Current Workflow Equals Latest shell: pwsh id: check-current-workflow-equals-latest - env: - CURRENT_BRANCH: ${{ github.head_ref }} run: | - $latestWorkflowRunNumber = $(gh run list --branch "$CURRENT_BRANCH" --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunJson = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json) + $latestWorkflowRunNumber = $latestWorkflowRunJson[0].databaseId $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From 77557dcc17f7a7e57694edaf8fc21364deac52c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 15:05:23 +0200 Subject: [PATCH 090/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 8e6738ed8..b45ec55b1 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,7 +26,7 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunJson = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json) + $latestWorkflowRunJson = $(gh run list --limit 1 --json databaseId | ConvertFrom-Json) $latestWorkflowRunNumber = $latestWorkflowRunJson[0].databaseId $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From 119e09161f75ee62cb177377a3db7ac71c6975c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 14 Aug 2023 15:07:24 +0200 Subject: [PATCH 091/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index b45ec55b1..d0c0b09c5 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,6 +27,7 @@ runs: id: check-current-workflow-equals-latest run: | $latestWorkflowRunJson = $(gh run list --limit 1 --json databaseId | ConvertFrom-Json) + echo "TEST=$latestWorkflowRunJson" $latestWorkflowRunNumber = $latestWorkflowRunJson[0].databaseId $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From d8c3d5a32ed86b69862ba92d59e57fb2dc5bcceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 17:36:08 +0200 Subject: [PATCH 092/128] Addressing if syntaxes and some comments. --- .../check-current-workflow-is-latest/action.yml | 3 +-- .../post-pull-request-checks-automation.yml | 14 +++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index d0c0b09c5..9ba028728 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -10,7 +10,7 @@ inputs: outputs: should-run: - description: The latest workflow run's database id. + description: Whether subsequent jobs should run. value: ${{ steps.check-current-workflow-equals-latest.outputs.should-run }} runs: @@ -19,7 +19,6 @@ runs: - name: Setup Scripts shell: pwsh run: | - "${{ github.action_path }}" >> $Env:GITHUB_PATH (Resolve-Path "${{ github.action_path }}/../../../Scripts").Path >> $Env:GITHUB_PATH - name: Check Current Workflow Equals Latest diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index d27c1dc71..8f8c531a7 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -51,49 +51,45 @@ jobs: timeout-minutes: ${{ inputs.timeout-minutes }} steps: - name: Check Further Steps Should Run + if: inputs.run-only-latest-workflow == 'true' uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 id: check-steps-should-run env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: current-workflow-id: ${{ github.run_id }} - if: inputs.run-only-latest-workflow == 'true' - name: Set Merge Token + if: steps.check-steps-should-run.outputs.should-run == 'true' shell: pwsh env: MERGE_TOKEN: ${{ secrets.MERGE_TOKEN }} run: | $mergeToken = $Env:MERGE_TOKEN ? $Env:MERGE_TOKEN : "${{ secrets.GITHUB_TOKEN }}" "MERGE_TOKEN=$mergeToken" >> $Env:GITHUB_ENV - if: | - (inputs.run-only-latest-workflow == 'false') || (steps.check-steps-should-run.outputs.should-run) - name: Automatically Merge Pull Request + if: steps.check-steps-should-run.outputs.should-run == 'true' uses: Lombiq/GitHub-Actions/.github/actions/auto-merge-pull-request@dev env: GITHUB_TOKEN: ${{ env.MERGE_TOKEN }} with: merge-method: ${{ inputs.merge-method }} - if: | - (inputs.run-only-latest-workflow == 'false') || (steps.check-steps-should-run.outputs.should-run) - name: Automatically Resolve or Done Jira issue + if: steps.check-steps-should-run.outputs.should-run == 'true' uses: Lombiq/GitHub-Actions/.github/actions/auto-resolve-done-jira-issue@dev env: GITHUB_TOKEN: ${{ env.MERGE_TOKEN }} JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - if: | - (inputs.run-only-latest-workflow == 'false') || (steps.check-steps-should-run.outputs.should-run) - name: Remove Label + if: steps.check-steps-should-run.outputs.should-run == 'true' # v2.0.0 uses: buildsville/add-remove-label@eeae411a9be2e173f2420e1644514edbecc4e835 with: token: ${{ env.MERGE_TOKEN }} labels: merge-and-resolve-jira-issue-if-checks-succeed type: remove - if: | - (inputs.run-only-latest-workflow == 'false') || (steps.check-steps-should-run.outputs.should-run) From 0e5a07d4a3b5d3adad2e5fbeaf6b97c859c062bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 17:43:11 +0200 Subject: [PATCH 093/128] Test --- .github/workflows/post-pull-request-checks-automation.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 8f8c531a7..01656ed13 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -50,6 +50,11 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: + - name: Checkout + uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/OSOE-655 + with: + token: ${{ secrets.CHECKOUT_TOKEN }} + - name: Check Further Steps Should Run if: inputs.run-only-latest-workflow == 'true' uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 From 6c26cc97426e2180ac3c090d79c61442cccf794a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 17:46:13 +0200 Subject: [PATCH 094/128] This shouldn't run. --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 01656ed13..b291fe1c1 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -92,7 +92,7 @@ jobs: - name: Remove Label if: steps.check-steps-should-run.outputs.should-run == 'true' - # v2.0.0 + # v2.0.0.0 uses: buildsville/add-remove-label@eeae411a9be2e173f2420e1644514edbecc4e835 with: token: ${{ env.MERGE_TOKEN }} From ee1e690cdece108eefd35da681a560f42952d7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 17:46:35 +0200 Subject: [PATCH 095/128] Run2 --- .github/actions/check-current-workflow-is-latest/action.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 9ba028728..40404b291 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -25,8 +25,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunJson = $(gh run list --limit 1 --json databaseId | ConvertFrom-Json) - echo "TEST=$latestWorkflowRunJson" - $latestWorkflowRunNumber = $latestWorkflowRunJson[0].databaseId - $currentEqualsLatest = ($latestWorkflowRunNumber -eq ${{ inputs.current-workflow-id }}) + $latestWorkflowRunDatabaseId = $(gh run list --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'should-run' $currentEqualsLatest From eb8eff628815a3a9166b588cb347e23bdf73e8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 17:51:58 +0200 Subject: [PATCH 096/128] Testing values. --- .github/actions/check-current-workflow-is-latest/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 40404b291..58a46816b 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,4 +27,7 @@ runs: run: | $latestWorkflowRunDatabaseId = $(gh run list --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) + echo "DBID=$latestWorkflowRunDatabaseId" + echo "INPUTSID=${{ inputs.current-workflow-id }}" + echo "THIS IS THE LATEST = $currentEqualsLatest" Set-GitHubOutput 'should-run' $currentEqualsLatest From ba71a00bb51f536c67bbd95656e2f0b4c7f8538a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 17:55:53 +0200 Subject: [PATCH 097/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 3 ++- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 58a46816b..63d9afb83 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -25,8 +25,9 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunDatabaseId = $(gh run list --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) + echo "${{ github.head_ref }}" echo "DBID=$latestWorkflowRunDatabaseId" echo "INPUTSID=${{ inputs.current-workflow-id }}" echo "THIS IS THE LATEST = $currentEqualsLatest" diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index b291fe1c1..01656ed13 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -92,7 +92,7 @@ jobs: - name: Remove Label if: steps.check-steps-should-run.outputs.should-run == 'true' - # v2.0.0.0 + # v2.0.0 uses: buildsville/add-remove-label@eeae411a9be2e173f2420e1644514edbecc4e835 with: token: ${{ env.MERGE_TOKEN }} From cf1b9289c54d0f23bc2918b251f8ea7b5ac9ebcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 17:58:35 +0200 Subject: [PATCH 098/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 63d9afb83..8a69e6af7 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -24,6 +24,7 @@ runs: - name: Check Current Workflow Equals Latest shell: pwsh id: check-current-workflow-equals-latest + # test run: | $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) From fbfa28186e6424f25dd192f0174ec531205bc479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 17:58:54 +0200 Subject: [PATCH 099/128] Test --- .github/workflows/post-pull-request-checks-automation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 01656ed13..ff39f65ba 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -93,6 +93,7 @@ jobs: - name: Remove Label if: steps.check-steps-should-run.outputs.should-run == 'true' # v2.0.0 + # test uses: buildsville/add-remove-label@eeae411a9be2e173f2420e1644514edbecc4e835 with: token: ${{ env.MERGE_TOKEN }} From a66304ed79cc3684103e468a89e991c2d74b58b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 18:00:55 +0200 Subject: [PATCH 100/128] Removing temp texts. --- .github/actions/check-current-workflow-is-latest/action.yml | 5 ----- .github/workflows/post-pull-request-checks-automation.yml | 1 - 2 files changed, 6 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 8a69e6af7..317718eab 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -24,12 +24,7 @@ runs: - name: Check Current Workflow Equals Latest shell: pwsh id: check-current-workflow-equals-latest - # test run: | $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) - echo "${{ github.head_ref }}" - echo "DBID=$latestWorkflowRunDatabaseId" - echo "INPUTSID=${{ inputs.current-workflow-id }}" - echo "THIS IS THE LATEST = $currentEqualsLatest" Set-GitHubOutput 'should-run' $currentEqualsLatest diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index ff39f65ba..01656ed13 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -93,7 +93,6 @@ jobs: - name: Remove Label if: steps.check-steps-should-run.outputs.should-run == 'true' # v2.0.0 - # test uses: buildsville/add-remove-label@eeae411a9be2e173f2420e1644514edbecc4e835 with: token: ${{ env.MERGE_TOKEN }} From 9008e48d27d8a7d382a9dcb6e82454bd5758c1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 15 Aug 2023 18:21:47 +0200 Subject: [PATCH 101/128] Adding description. --- .github/actions/check-current-workflow-is-latest/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 317718eab..3f5b07e8c 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -1,6 +1,7 @@ -# Intentionally not documented in Actions.md since it's only meant for internal use name: Check Current Workflow Is The Latest Workflow -description: Checks whether the current workflow is the most recent workflow for the pull request. +description: > + Checks whether the current workflow is the most recent workflow for the pull request. + Intentionally not documented in Actions.md since it's only meant for internal use. inputs: current-workflow-id: From c096a6fae5d4d18c86e9c417f50e9b46bfced4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= <92299130+Psichorex@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:52:24 +0200 Subject: [PATCH 102/128] Update .github/actions/check-current-workflow-is-latest/action.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 3f5b07e8c..93e01f3f6 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -1,4 +1,4 @@ -name: Check Current Workflow Is The Latest Workflow +name: Check Current Workflow is the Latest Workflow description: > Checks whether the current workflow is the most recent workflow for the pull request. Intentionally not documented in Actions.md since it's only meant for internal use. From dc29f023e7c32614f432e3e0e44e8f54e002e20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= <92299130+Psichorex@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:52:32 +0200 Subject: [PATCH 103/128] Update .github/actions/check-current-workflow-is-latest/action.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zoltán Lehóczky --- .github/actions/check-current-workflow-is-latest/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 93e01f3f6..fc991b7b5 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -1,7 +1,7 @@ name: Check Current Workflow is the Latest Workflow description: > - Checks whether the current workflow is the most recent workflow for the pull request. - Intentionally not documented in Actions.md since it's only meant for internal use. + Checks whether the current workflow is the most recent workflow for the pull request. Intentionally not documented in + Actions.md since it's only meant for internal use. inputs: current-workflow-id: From 8930aaac8c3fa81a8b9b98418206454c6b5e9ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:01:41 +0200 Subject: [PATCH 104/128] Renaming + temp removing checkout. --- .../check-current-workflow-is-latest/action.yml | 8 ++++---- .../post-pull-request-checks-automation.yml | 14 +++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 3f5b07e8c..e1f853c8c 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -10,9 +10,9 @@ inputs: default: "" outputs: - should-run: - description: Whether subsequent jobs should run. - value: ${{ steps.check-current-workflow-equals-latest.outputs.should-run }} + is-latest: + description: A boolean value indicating whether the current workflow is the most recent one. + value: ${{ steps.check-current-workflow-equals-latest.outputs.is-latest }} runs: using: "composite" @@ -28,4 +28,4 @@ runs: run: | $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) - Set-GitHubOutput 'should-run' $currentEqualsLatest + Set-GitHubOutput 'is-latest' $currentEqualsLatest diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 01656ed13..b3058e662 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -47,14 +47,10 @@ on: jobs: post-pull-request-checks-automation: + name: Post Pull Request Checks Automation runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: - - name: Checkout - uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/OSOE-655 - with: - token: ${{ secrets.CHECKOUT_TOKEN }} - - name: Check Further Steps Should Run if: inputs.run-only-latest-workflow == 'true' uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 @@ -65,7 +61,7 @@ jobs: current-workflow-id: ${{ github.run_id }} - name: Set Merge Token - if: steps.check-steps-should-run.outputs.should-run == 'true' + if: steps.check-steps-should-run.outputs.is-latest == 'true' shell: pwsh env: MERGE_TOKEN: ${{ secrets.MERGE_TOKEN }} @@ -74,7 +70,7 @@ jobs: "MERGE_TOKEN=$mergeToken" >> $Env:GITHUB_ENV - name: Automatically Merge Pull Request - if: steps.check-steps-should-run.outputs.should-run == 'true' + if: steps.check-steps-should-run.outputs.is-latest == 'true' uses: Lombiq/GitHub-Actions/.github/actions/auto-merge-pull-request@dev env: GITHUB_TOKEN: ${{ env.MERGE_TOKEN }} @@ -82,7 +78,7 @@ jobs: merge-method: ${{ inputs.merge-method }} - name: Automatically Resolve or Done Jira issue - if: steps.check-steps-should-run.outputs.should-run == 'true' + if: steps.check-steps-should-run.outputs.is-latest == 'true' uses: Lombiq/GitHub-Actions/.github/actions/auto-resolve-done-jira-issue@dev env: GITHUB_TOKEN: ${{ env.MERGE_TOKEN }} @@ -91,7 +87,7 @@ jobs: JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - name: Remove Label - if: steps.check-steps-should-run.outputs.should-run == 'true' + if: steps.check-steps-should-run.outputs.is-latest == 'true' # v2.0.0 uses: buildsville/add-remove-label@eeae411a9be2e173f2420e1644514edbecc4e835 with: From 67703f3473e4f5f7145f785abcdd0fd8609b40aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:02:29 +0200 Subject: [PATCH 105/128] Adding echo for testing. --- .github/actions/check-current-workflow-is-latest/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index d68214db1..30d24167d 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,5 +27,6 @@ runs: id: check-current-workflow-equals-latest run: | $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + echo "THIS VAR SHOULD HAVE VALUE=$latestWorkflowRunDatabaseId" $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From 22e913ae673cecc2f1982242200310121f1c7de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:07:56 +0200 Subject: [PATCH 106/128] Adding back checkout. --- .github/workflows/post-pull-request-checks-automation.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index b3058e662..e7be9fb0b 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -51,6 +51,9 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: + - name: Checkout + uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/OSOE-655 + - name: Check Further Steps Should Run if: inputs.run-only-latest-workflow == 'true' uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 From 4c8581f30be39579ddde7c4377eb5936a701092e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:09:15 +0200 Subject: [PATCH 107/128] Fix. --- .github/workflows/post-pull-request-checks-automation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index e7be9fb0b..1437b6196 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -53,6 +53,8 @@ jobs: steps: - name: Checkout uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/OSOE-655 + with: + token: ${{ secrets.CHECKOUT_TOKEN }} - name: Check Further Steps Should Run if: inputs.run-only-latest-workflow == 'true' From a7f5622b8a9cdd5dd3793ecd24deb7931dd155dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:38:36 +0200 Subject: [PATCH 108/128] Test. --- .github/actions/check-current-workflow-is-latest/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 30d24167d..80678221e 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,8 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | + $testVar = $(gh run list) + echo "TEST VAR=$testVar" $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId echo "THIS VAR SHOULD HAVE VALUE=$latestWorkflowRunDatabaseId" $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) From cf63121fb0f1b0da16c5e5fdc2eb6d68461aa2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:39:24 +0200 Subject: [PATCH 109/128] Remove checkout. --- .github/workflows/post-pull-request-checks-automation.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 1437b6196..b3058e662 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -51,11 +51,6 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: ${{ inputs.timeout-minutes }} steps: - - name: Checkout - uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/OSOE-655 - with: - token: ${{ secrets.CHECKOUT_TOKEN }} - - name: Check Further Steps Should Run if: inputs.run-only-latest-workflow == 'true' uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 From 25eff63bee4790632497c14888eb7f842d096bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:44:16 +0200 Subject: [PATCH 110/128] Testing repo. --- .github/actions/check-current-workflow-is-latest/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 80678221e..16244bc7f 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,8 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | + $repo = ${{ github.repository }} + echo "REPO = $repo" $testVar = $(gh run list) echo "TEST VAR=$testVar" $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId From b27580fc15892a334e735d57afce2cf2487f1583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:55:05 +0200 Subject: [PATCH 111/128] Testing. --- .github/actions/check-current-workflow-is-latest/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 16244bc7f..531b62497 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,8 +27,7 @@ runs: id: check-current-workflow-equals-latest run: | $repo = ${{ github.repository }} - echo "REPO = $repo" - $testVar = $(gh run list) + $testVar = $(gh run list --repo $repo) echo "TEST VAR=$testVar" $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId echo "THIS VAR SHOULD HAVE VALUE=$latestWorkflowRunDatabaseId" From 75476a176f768516efaecd21d2661a0f76317738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:56:39 +0200 Subject: [PATCH 112/128] Testing. --- .github/actions/check-current-workflow-is-latest/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 531b62497..192e075ac 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,8 +26,7 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $repo = ${{ github.repository }} - $testVar = $(gh run list --repo $repo) + $testVar = $(gh run list --repo ${{ github.repository }}) echo "TEST VAR=$testVar" $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId echo "THIS VAR SHOULD HAVE VALUE=$latestWorkflowRunDatabaseId" From 054025a2cc4b8a660bda73e06fa8bf29616fcf58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 15:58:49 +0200 Subject: [PATCH 113/128] Adding repo identifier. --- .github/actions/check-current-workflow-is-latest/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 192e075ac..a43776bda 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,9 +26,7 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $testVar = $(gh run list --repo ${{ github.repository }}) - echo "TEST VAR=$testVar" - $latestWorkflowRunDatabaseId = $(gh run list --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunDatabaseId = $(gh run list --repo ${{ github.repository }} --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId echo "THIS VAR SHOULD HAVE VALUE=$latestWorkflowRunDatabaseId" $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From 51d8dc6afe654bd3f3ccce0f3caccc3780ff2791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 16:00:54 +0200 Subject: [PATCH 114/128] Removing echo. --- .github/actions/check-current-workflow-is-latest/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index a43776bda..7ce324b59 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,6 +27,5 @@ runs: id: check-current-workflow-equals-latest run: | $latestWorkflowRunDatabaseId = $(gh run list --repo ${{ github.repository }} --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId - echo "THIS VAR SHOULD HAVE VALUE=$latestWorkflowRunDatabaseId" $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From a5184bf2d3c4b10052cbc00d5ede8e884c2eea44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 16:07:46 +0200 Subject: [PATCH 115/128] More testing. --- .github/actions/check-current-workflow-is-latest/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 7ce324b59..701408a9c 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -28,4 +28,7 @@ runs: run: | $latestWorkflowRunDatabaseId = $(gh run list --repo ${{ github.repository }} --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) + echo "EQUALS LATEST = $currentEqualsLatest" + echo "VALUE1 = $latestWorkflowRunDatabaseId" + echo "VALUE2 = ${{ inputs.current-workflow-id }}" Set-GitHubOutput 'is-latest' $currentEqualsLatest From abee4f2bc2aa0b6400029cd126dda7bbcfa65352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 18:35:46 +0200 Subject: [PATCH 116/128] Removing echos and adding more filter to the query. --- .github/actions/check-current-workflow-is-latest/action.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 701408a9c..46f06bc2d 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,9 +26,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunDatabaseId = $(gh run list --repo ${{ github.repository }} --branch ${{ github.head_ref }} --limit 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunDatabaseId = $(gh run list -r ${{ github.repository }} -s in_progress -b ${{ github.head_ref }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) - echo "EQUALS LATEST = $currentEqualsLatest" - echo "VALUE1 = $latestWorkflowRunDatabaseId" - echo "VALUE2 = ${{ inputs.current-workflow-id }}" Set-GitHubOutput 'is-latest' $currentEqualsLatest From d6eec60c570ec28b931a7767b9c2ce0ea462ccf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Thu, 17 Aug 2023 18:40:28 +0200 Subject: [PATCH 117/128] Fixing status switch. --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 46f06bc2d..ff6e81e80 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunDatabaseId = $(gh run list -r ${{ github.repository }} -s in_progress -b ${{ github.head_ref }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunDatabaseId = $(gh run list -r ${{ github.repository }} -s success -b ${{ github.head_ref }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From c3f0cfd78515f06a9c17835f1a6414b7047331c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 18 Aug 2023 08:31:04 +0200 Subject: [PATCH 118/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index ff6e81e80..9a1afc753 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,7 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunDatabaseId = $(gh run list -r ${{ github.repository }} -s success -b ${{ github.head_ref }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $test = ${{ github.workflow }} + $latestWorkflowRunDatabaseId = $(gh run list -r ${{ github.repository }} -b ${{ github.head_ref }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From abfbcdf6482c0808521218bba6d4b2d7bd76fca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 18 Aug 2023 08:34:51 +0200 Subject: [PATCH 119/128] Test --- .github/actions/check-current-workflow-is-latest/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 9a1afc753..192d812c7 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,7 +26,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $test = ${{ github.workflow }} - $latestWorkflowRunDatabaseId = $(gh run list -r ${{ github.repository }} -b ${{ github.head_ref }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunDatabaseId = $(gh run list -r ${{ github.repository }} -b ${{ github.head_ref }} -w ${{ github.workflow }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From 69cf3850531b1de21ff3978f53c300fde6730868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 18 Aug 2023 08:37:27 +0200 Subject: [PATCH 120/128] r to R fix. --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 192d812c7..d02431285 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunDatabaseId = $(gh run list -r ${{ github.repository }} -b ${{ github.head_ref }} -w ${{ github.workflow }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunDatabaseId = $(gh run list -R ${{ github.repository }} -b ${{ github.head_ref }} -w ${{ github.workflow }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From c665d815c96809dd1347007f0db2612f34dd4997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 18 Aug 2023 08:39:20 +0200 Subject: [PATCH 121/128] To string. --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index d02431285..a53c8a857 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,6 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunDatabaseId = $(gh run list -R ${{ github.repository }} -b ${{ github.head_ref }} -w ${{ github.workflow }} -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $latestWorkflowRunDatabaseId = $(gh run list -R '${{ github.repository }}' -b '${{ github.head_ref }}' -w '${{ github.workflow }}' -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From 7d6b48473833c26e7bff346683fe76dd35f37143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 18 Aug 2023 19:10:00 +0200 Subject: [PATCH 122/128] Using Splatting. --- .../actions/check-current-workflow-is-latest/action.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index a53c8a857..28b4d2406 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,6 +26,13 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $latestWorkflowRunDatabaseId = $(gh run list -R '${{ github.repository }}' -b '${{ github.head_ref }}' -w '${{ github.workflow }}' -L 1 --json databaseId | ConvertFrom-Json)[0].databaseId + $listArguments = @{ + repo = '${{ github.repository }}' + branch = '${{ github.head_ref }}' + workflow = '${{ github.workflow }}' + limit = '1' + json = 'databaseId' + } + $latestWorkflowRunDatabaseId = $(gh run list @listArguments | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From 8320b07e16c8d9109d391a9868898d7521037261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 18 Aug 2023 19:23:43 +0200 Subject: [PATCH 123/128] test --- .../check-current-workflow-is-latest/action.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 28b4d2406..d0d3f6a7e 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -27,12 +27,13 @@ runs: id: check-current-workflow-equals-latest run: | $listArguments = @{ - repo = '${{ github.repository }}' - branch = '${{ github.head_ref }}' - workflow = '${{ github.workflow }}' - limit = '1' - json = 'databaseId' + repo = '${{ github.repository }}' + branch = '${{ github.head_ref }}' + workflow = '${{ github.workflow }}' + limit = '1' + json = 'databaseId' } - $latestWorkflowRunDatabaseId = $(gh run list @listArguments | ConvertFrom-Json)[0].databaseId + $latestWorkflowRun = $(gh run list @listArguments) + $latestWorkflowRunDatabaseId = $($latestWorkflowRun | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From f95f6d1373388afef0597894e537c66c4d34f9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 18 Aug 2023 19:27:05 +0200 Subject: [PATCH 124/128] Fix --- .github/actions/check-current-workflow-is-latest/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index d0d3f6a7e..9b6749193 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -30,7 +30,7 @@ runs: repo = '${{ github.repository }}' branch = '${{ github.head_ref }}' workflow = '${{ github.workflow }}' - limit = '1' + limit = 1 json = 'databaseId' } $latestWorkflowRun = $(gh run list @listArguments) From a6ed50eb5684b312b26dfda9bc6130e587eb3efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 18 Aug 2023 19:35:43 +0200 Subject: [PATCH 125/128] Test --- .../check-current-workflow-is-latest/action.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 9b6749193..9fff5d64b 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,14 +26,10 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $listArguments = @{ - repo = '${{ github.repository }}' - branch = '${{ github.head_ref }}' - workflow = '${{ github.workflow }}' - limit = 1 - json = 'databaseId' - } - $latestWorkflowRun = $(gh run list @listArguments) + $repo = '${{ github.repository }}' + $branch = '${{ github.head_ref }}' + $workflow = '${{ github.workflow }}' + $latestWorkflowRun = $(gh run list --repo $repo --branch $branch --workflow $workflow --limit 1 --json databaseId) $latestWorkflowRunDatabaseId = $($latestWorkflowRun | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From 2e26bef7d3b95bddcb2e2c1d2b0f8b5b12837aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 20 Aug 2023 11:01:29 +0200 Subject: [PATCH 126/128] Test with splatting. --- .../check-current-workflow-is-latest/action.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/actions/check-current-workflow-is-latest/action.yml b/.github/actions/check-current-workflow-is-latest/action.yml index 9fff5d64b..7c716d8f6 100644 --- a/.github/actions/check-current-workflow-is-latest/action.yml +++ b/.github/actions/check-current-workflow-is-latest/action.yml @@ -26,10 +26,13 @@ runs: shell: pwsh id: check-current-workflow-equals-latest run: | - $repo = '${{ github.repository }}' - $branch = '${{ github.head_ref }}' - $workflow = '${{ github.workflow }}' - $latestWorkflowRun = $(gh run list --repo $repo --branch $branch --workflow $workflow --limit 1 --json databaseId) - $latestWorkflowRunDatabaseId = $($latestWorkflowRun | ConvertFrom-Json)[0].databaseId + $listSwitches = @( + '--repo', '${{ github.repository }}' + '--branch', '${{ github.head_ref }}' + '--workflow', '${{ github.workflow }}' + '--limit', '1' + '--json', 'databaseId' + ) + $latestWorkflowRunDatabaseId = $(gh run list @listSwitches | ConvertFrom-Json)[0].databaseId $currentEqualsLatest = ($latestWorkflowRunDatabaseId -eq ${{ inputs.current-workflow-id }}) Set-GitHubOutput 'is-latest' $currentEqualsLatest From 3ea457f11db9c774f64c076e78c507c18d5404f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sun, 20 Aug 2023 11:03:24 +0200 Subject: [PATCH 127/128] != false instead of == true --- .github/workflows/post-pull-request-checks-automation.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index b3058e662..16ff5a073 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -61,7 +61,7 @@ jobs: current-workflow-id: ${{ github.run_id }} - name: Set Merge Token - if: steps.check-steps-should-run.outputs.is-latest == 'true' + if: steps.check-steps-should-run.outputs.is-latest != 'false' shell: pwsh env: MERGE_TOKEN: ${{ secrets.MERGE_TOKEN }} @@ -70,7 +70,7 @@ jobs: "MERGE_TOKEN=$mergeToken" >> $Env:GITHUB_ENV - name: Automatically Merge Pull Request - if: steps.check-steps-should-run.outputs.is-latest == 'true' + if: steps.check-steps-should-run.outputs.is-latest != 'false' uses: Lombiq/GitHub-Actions/.github/actions/auto-merge-pull-request@dev env: GITHUB_TOKEN: ${{ env.MERGE_TOKEN }} @@ -78,7 +78,7 @@ jobs: merge-method: ${{ inputs.merge-method }} - name: Automatically Resolve or Done Jira issue - if: steps.check-steps-should-run.outputs.is-latest == 'true' + if: steps.check-steps-should-run.outputs.is-latest != 'false' uses: Lombiq/GitHub-Actions/.github/actions/auto-resolve-done-jira-issue@dev env: GITHUB_TOKEN: ${{ env.MERGE_TOKEN }} @@ -87,7 +87,7 @@ jobs: JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - name: Remove Label - if: steps.check-steps-should-run.outputs.is-latest == 'true' + if: steps.check-steps-should-run.outputs.is-latest != 'false' # v2.0.0 uses: buildsville/add-remove-label@eeae411a9be2e173f2420e1644514edbecc4e835 with: From fca744fb42d93db563388c6c5f598711fac48227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sun, 20 Aug 2023 17:23:31 +0200 Subject: [PATCH 128/128] Reverting issue branch references for GHA --- .github/workflows/post-pull-request-checks-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post-pull-request-checks-automation.yml b/.github/workflows/post-pull-request-checks-automation.yml index 16ff5a073..5cfba578c 100644 --- a/.github/workflows/post-pull-request-checks-automation.yml +++ b/.github/workflows/post-pull-request-checks-automation.yml @@ -53,7 +53,7 @@ jobs: steps: - name: Check Further Steps Should Run if: inputs.run-only-latest-workflow == 'true' - uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@issue/OSOE-655 + uses: Lombiq/GitHub-Actions/.github/actions/check-current-workflow-is-latest@dev id: check-steps-should-run env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}