From 9c6b713c31aa97506f54ce50b5e8e53f41e54960 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 11:56:37 +0100 Subject: [PATCH 01/15] try something --- .github/workflows/check-pr-title.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/check-pr-title.yml diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml new file mode 100644 index 0000000000..e0d99815a5 --- /dev/null +++ b/.github/workflows/check-pr-title.yml @@ -0,0 +1,11 @@ +name: Pull Request Title +on: + pull_request_target: + types: [opened, edited, synchronize] + branches: + - 'main' +jobs: + label: + runs-on: ubuntu-latest + steps: + - echo {{event.changes.title.from}} From 0b1ff3bdfcfbecb9de57e005537127c4d61f3643 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 11:59:05 +0100 Subject: [PATCH 02/15] test --- .github/workflows/check-pr-title.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index e0d99815a5..2a11d417f5 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -1,6 +1,7 @@ name: Pull Request Title on: - pull_request_target: + pull_request: + # pull_request_target: types: [opened, edited, synchronize] branches: - 'main' From d545190708689c29b346bec89120d4d202c70153 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 11:59:21 +0100 Subject: [PATCH 03/15] test --- .github/workflows/check-pr-title.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 2a11d417f5..32fe475d3b 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -3,8 +3,8 @@ on: pull_request: # pull_request_target: types: [opened, edited, synchronize] - branches: - - 'main' + # branches: + # - 'main' jobs: label: runs-on: ubuntu-latest From b6498fb9cd817c0dd49896bd0027442f312d87ad Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:00:25 +0100 Subject: [PATCH 04/15] test --- .github/workflows/check-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 32fe475d3b..d73ad34bf6 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -9,4 +9,4 @@ jobs: label: runs-on: ubuntu-latest steps: - - echo {{event.changes.title.from}} + - run: echo {{event.changes.title.from}} From f7d2c9990ec7f6f44ef55fc66921c06850edf50c Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:01:13 +0100 Subject: [PATCH 05/15] try --- .github/workflows/check-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index d73ad34bf6..b58ee10362 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -9,4 +9,4 @@ jobs: label: runs-on: ubuntu-latest steps: - - run: echo {{event.changes.title.from}} + - run: echo ${{ event.changes.title.from }} From bb76db0585ef0a83efe39e2f1280d0de3fce49d7 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:02:24 +0100 Subject: [PATCH 06/15] test --- .github/workflows/check-pr-title.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index b58ee10362..6690e8ee9f 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -9,4 +9,7 @@ jobs: label: runs-on: ubuntu-latest steps: - - run: echo ${{ event.changes.title.from }} + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(event) }} + run: echo "$GITHUB_CONTEXT" From 6e0faab77675f276c44f8d6118c90b3b73665e92 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:03:49 +0100 Subject: [PATCH 07/15] test --- .github/workflows/check-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 6690e8ee9f..444c2dfc7d 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -11,5 +11,5 @@ jobs: steps: - name: Dump GitHub context env: - GITHUB_CONTEXT: ${{ toJson(event) }} + GITHUB_CONTEXT: ${{ toJson(github.event) }} run: echo "$GITHUB_CONTEXT" From 637065f443722351e7509a7d57120a27cadac803 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:23:51 +0100 Subject: [PATCH 08/15] test --- .github/workflows/check-pr-title.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 444c2dfc7d..e16c9a43a5 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -2,14 +2,29 @@ name: Pull Request Title on: pull_request: # pull_request_target: - types: [opened, edited, synchronize] + types: [edited] # branches: # - 'main' jobs: label: runs-on: ubuntu-latest steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github.event) }} - run: echo "$GITHUB_CONTEXT" + - name: Get previous target branch + uses: ./.github/actions/get_target_branch + id: get-previous-target-branch + with: + text: ${{ github.event.changes.title }} + + - name: Get current target branch + uses: ./.github/actions/get_target_branch + id: get-current-target-branch + with: + text: ${{ github.event.pull_request.title }} + + - name: debug + run: echo "${{ steps.get-previous-target-branch.outputs.target-branch }} ${{ steps.get-current-target-branch.outputs.target-branch }}" + + - name: Check target branch change + if: ${{ steps.get-previous-target-branch.outputs.target-branch }} != ${{ steps.get-current-target-branch.outputs.target-branch }} + run: + From c748e3d7fac32bcb7d04832d4ebc1c2123c0ca70 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:27:44 +0100 Subject: [PATCH 09/15] test --- .github/workflows/check-pr-title.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index e16c9a43a5..45ada18888 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -9,6 +9,9 @@ jobs: label: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Get previous target branch uses: ./.github/actions/get_target_branch id: get-previous-target-branch @@ -21,8 +24,8 @@ jobs: with: text: ${{ github.event.pull_request.title }} - - name: debug - run: echo "${{ steps.get-previous-target-branch.outputs.target-branch }} ${{ steps.get-current-target-branch.outputs.target-branch }}" + # - name: debug + # run: echo "${{ steps.get-previous-target-branch.outputs.target-branch }} ${{ steps.get-current-target-branch.outputs.target-branch }}" - name: Check target branch change if: ${{ steps.get-previous-target-branch.outputs.target-branch }} != ${{ steps.get-current-target-branch.outputs.target-branch }} From 53608f7ae471d907762ae7279ca3333e7a09c4ce Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:28:38 +0100 Subject: [PATCH 10/15] test --- .github/workflows/check-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 45ada18888..19dee163a9 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -29,5 +29,5 @@ jobs: - name: Check target branch change if: ${{ steps.get-previous-target-branch.outputs.target-branch }} != ${{ steps.get-current-target-branch.outputs.target-branch }} - run: + run: echo "IT CHANGED" From 0cf90718ffc22767d06d819f69ac65b3bf504814 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:32:16 +0100 Subject: [PATCH 11/15] test --- .github/workflows/check-pr-title.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 19dee163a9..f797ca5585 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -12,11 +12,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: debug + run: echo "${{ toJSON(steps.get-previous-target-branch.outputs.target-branch) }} ${{ toJSON(steps.get-current-target-branch.outputs.target-branch) }}" + + - name: Get previous target branch uses: ./.github/actions/get_target_branch id: get-previous-target-branch with: - text: ${{ github.event.changes.title }} + text: ${{ toJSON(github.event.changes.title) }} - name: Get current target branch uses: ./.github/actions/get_target_branch @@ -24,8 +28,6 @@ jobs: with: text: ${{ github.event.pull_request.title }} - # - name: debug - # run: echo "${{ steps.get-previous-target-branch.outputs.target-branch }} ${{ steps.get-current-target-branch.outputs.target-branch }}" - name: Check target branch change if: ${{ steps.get-previous-target-branch.outputs.target-branch }} != ${{ steps.get-current-target-branch.outputs.target-branch }} From 4e348e5f17253b1889c50313fbd4cb2507cb9d98 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:33:26 +0100 Subject: [PATCH 12/15] test --- .github/workflows/check-pr-title.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index f797ca5585..c1490bed37 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: debug - run: echo "${{ toJSON(steps.get-previous-target-branch.outputs.target-branch) }} ${{ toJSON(steps.get-current-target-branch.outputs.target-branch) }}" + run: echo "${{ toJSON(github.event.changes.title) }} ${{ toJSON(github.event.pull_request.title) }}" - name: Get previous target branch @@ -28,6 +28,11 @@ jobs: with: text: ${{ github.event.pull_request.title }} + - name: debug + run: echo "${{ toJSON(steps.get-previous-target-branch.outputs.target-branch) }} ${{ toJSON(steps.get-current-target-branch.outputs.target-branch) }}" + + + - name: Check target branch change if: ${{ steps.get-previous-target-branch.outputs.target-branch }} != ${{ steps.get-current-target-branch.outputs.target-branch }} From d0c45dd5408dee8566b1c39c4970c07d00b80f74 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:35:03 +0100 Subject: [PATCH 13/15] test --- .github/workflows/check-pr-title.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index c1490bed37..223ed6c4c4 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -12,15 +12,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: debug - run: echo "${{ toJSON(github.event.changes.title) }} ${{ toJSON(github.event.pull_request.title) }}" - - - name: Get previous target branch uses: ./.github/actions/get_target_branch id: get-previous-target-branch with: - text: ${{ toJSON(github.event.changes.title) }} + text: ${{ github.event.changes.title.from }} - name: Get current target branch uses: ./.github/actions/get_target_branch @@ -31,9 +27,6 @@ jobs: - name: debug run: echo "${{ toJSON(steps.get-previous-target-branch.outputs.target-branch) }} ${{ toJSON(steps.get-current-target-branch.outputs.target-branch) }}" - - - - name: Check target branch change if: ${{ steps.get-previous-target-branch.outputs.target-branch }} != ${{ steps.get-current-target-branch.outputs.target-branch }} run: echo "IT CHANGED" From 61df1cbc9baa72c09943e3fa9483d35ff94322c2 Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 12:43:17 +0100 Subject: [PATCH 14/15] test --- .github/workflows/check-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 223ed6c4c4..de585e17c5 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -28,6 +28,6 @@ jobs: run: echo "${{ toJSON(steps.get-previous-target-branch.outputs.target-branch) }} ${{ toJSON(steps.get-current-target-branch.outputs.target-branch) }}" - name: Check target branch change - if: ${{ steps.get-previous-target-branch.outputs.target-branch }} != ${{ steps.get-current-target-branch.outputs.target-branch }} + if: steps.get-previous-target-branch.outputs.target-branch != steps.get-current-target-branch.outputs.target-branch run: echo "IT CHANGED" From d0554f1e3edad352f9ca7655f9c32b4bbb45ca9d Mon Sep 17 00:00:00 2001 From: simon-id Date: Mon, 27 Jan 2025 15:11:08 +0100 Subject: [PATCH 15/15] test --- .github/workflows/check-pr-title.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index de585e17c5..5993761e1b 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -6,7 +6,7 @@ on: # branches: # - 'main' jobs: - label: + check-title: runs-on: ubuntu-latest steps: - name: Checkout @@ -27,7 +27,14 @@ jobs: - name: debug run: echo "${{ toJSON(steps.get-previous-target-branch.outputs.target-branch) }} ${{ toJSON(steps.get-current-target-branch.outputs.target-branch) }}" - - name: Check target branch change + - name: Trigger CI if: steps.get-previous-target-branch.outputs.target-branch != steps.get-current-target-branch.outputs.target-branch - run: echo "IT CHANGED" - + run: | + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}/actions/workflows/ci.yml/dispatches \ + -f "ref=${{ github.event.pull_request.head.ref }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file