From 8b714cc3583a7c163e0af6e42277c54015e32e12 Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:01:39 +0900 Subject: [PATCH 1/9] ci: add dispatch-push-event workflow Signed-off-by: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> --- .github/workflows/dispatch-push-event.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/dispatch-push-event.yaml diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml new file mode 100644 index 0000000000000..60ed9ec29816a --- /dev/null +++ b/.github/workflows/dispatch-push-event.yaml @@ -0,0 +1,30 @@ +name: dispatch-push-event +on: + push: + branches: + - beta/v0.3.** + +env: + DISPATCH_REPO: pilot-auto.x1.eve + +jobs: + dispatch-push-event: + runs-on: ubuntu-latest + + steps: + - name: Generate token + id: generate-token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.PRIVATE_KEY }} + + - name: Workflow Dispatch with curl command + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ steps.generate-token.outputs.token }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/tier4/${{ env.DISPATCH_REPO }}/actions/workflows/update-beta-branch.yaml/dispatches \ + -d '{"ref":"main"}' From 57cecc10e05639ff6349ec82656af353daf314db Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Tue, 5 Sep 2023 20:14:32 +0900 Subject: [PATCH 2/9] fix: change APP KEY Signed-off-by: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> --- .github/workflows/dispatch-push-event.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml index 60ed9ec29816a..6bc61d10675ff 100644 --- a/.github/workflows/dispatch-push-event.yaml +++ b/.github/workflows/dispatch-push-event.yaml @@ -16,8 +16,8 @@ jobs: id: generate-token uses: tibdex/github-app-token@v1 with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} + app_id: ${{ secrets.INTERNAL_APP_ID }} + private_key: ${{ secrets.INTERNAL_PRIVATE_KEY }} - name: Workflow Dispatch with curl command run: | From ad2d3fee6ab0e8b8b546c7b0fb0477350a281ae9 Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:22:19 +0900 Subject: [PATCH 3/9] chore: use strategy Signed-off-by: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> --- .github/workflows/dispatch-push-event.yaml | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml index 6bc61d10675ff..ae3f1624ead00 100644 --- a/.github/workflows/dispatch-push-event.yaml +++ b/.github/workflows/dispatch-push-event.yaml @@ -2,15 +2,31 @@ name: dispatch-push-event on: push: branches: - - beta/v0.3.** - -env: - DISPATCH_REPO: pilot-auto.x1.eve + - beta/** jobs: - dispatch-push-event: + search-dispatch-repo: runs-on: ubuntu-latest + strategy: + matrix: + include: + - { dispatch-repo: "pilot-auto.x1.eve", version: "beta/v0.3.**" } + outputs: + dispatch-repo: ${{ steps.search-dispatch-repo.outputs.value }} + steps: + - name: Search dispatch repo + id: search-dispatch-repo + run: | + if [[ ${{ github.ref_name }} =~ ${{ matrix.version }} ]]; then + echo ::set-output name=value::"${{ matrix.dispatch-repo }}" + echo "Detected beta branch: ${{ github.ref_name }}" + echo "Dispatch repository: ${{ matrix.dispatch-repo }}" + fi + dispatch-push-event: + runs-on: ubuntu-latest + needs: search-dispatch-repo + if: ${{ needs.search-dispatch-repo.outputs.dispatch-repo != '' }} steps: - name: Generate token id: generate-token @@ -26,5 +42,5 @@ jobs: -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{ steps.generate-token.outputs.token }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/tier4/${{ env.DISPATCH_REPO }}/actions/workflows/update-beta-branch.yaml/dispatches \ + https://api.github.com/repos/tier4/${{ needs.search-dispatch-repo.outputs.dispatch-repo }}/actions/workflows/update-beta-branch.yaml/dispatches \ -d '{"ref":"main"}' From f85951631f69d6f9cae491ca301a4ca2db6a2bfc Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Wed, 6 Sep 2023 18:10:55 +0900 Subject: [PATCH 4/9] chore: change trigger Signed-off-by: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> --- .github/workflows/dispatch-push-event.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml index ae3f1624ead00..d405c7aa215f1 100644 --- a/.github/workflows/dispatch-push-event.yaml +++ b/.github/workflows/dispatch-push-event.yaml @@ -1,8 +1,6 @@ name: dispatch-push-event on: push: - branches: - - beta/** jobs: search-dispatch-repo: From 99f16bd7c0671e518b2896f3a955f6ff2f8dc569 Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Wed, 6 Sep 2023 18:47:11 +0900 Subject: [PATCH 5/9] pre-commit fixes Signed-off-by: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> --- .github/workflows/dispatch-push-event.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml index d405c7aa215f1..52324c1ac9322 100644 --- a/.github/workflows/dispatch-push-event.yaml +++ b/.github/workflows/dispatch-push-event.yaml @@ -8,7 +8,7 @@ jobs: strategy: matrix: include: - - { dispatch-repo: "pilot-auto.x1.eve", version: "beta/v0.3.**" } + - { dispatch-repo: pilot-auto.x1.eve, version: beta/v0.3.** } outputs: dispatch-repo: ${{ steps.search-dispatch-repo.outputs.value }} steps: From 629bd00fcae371a9339502362943752831632ce8 Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:59:40 +0900 Subject: [PATCH 6/9] Update .github/workflows/dispatch-push-event.yaml --- .github/workflows/dispatch-push-event.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml index 52324c1ac9322..99ff366c0e93c 100644 --- a/.github/workflows/dispatch-push-event.yaml +++ b/.github/workflows/dispatch-push-event.yaml @@ -33,7 +33,7 @@ jobs: app_id: ${{ secrets.INTERNAL_APP_ID }} private_key: ${{ secrets.INTERNAL_PRIVATE_KEY }} - - name: Workflow Dispatch with curl command + - name: Dispatch the update-beta-branch workflow run: | curl -L \ -X POST \ From 50221bb553178b09f138086df103c86ec34e83b2 Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:59:55 +0900 Subject: [PATCH 7/9] Update .github/workflows/dispatch-push-event.yaml --- .github/workflows/dispatch-push-event.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml index 99ff366c0e93c..c7ffb921f8fd2 100644 --- a/.github/workflows/dispatch-push-event.yaml +++ b/.github/workflows/dispatch-push-event.yaml @@ -8,7 +8,7 @@ jobs: strategy: matrix: include: - - { dispatch-repo: pilot-auto.x1.eve, version: beta/v0.3.** } + - { version: beta/v0.3.**, dispatch-repo: pilot-auto.x1.eve } outputs: dispatch-repo: ${{ steps.search-dispatch-repo.outputs.value }} steps: From 037067752e26018761b369f1c2ea6240ebe4b428 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Sep 2023 03:01:20 +0000 Subject: [PATCH 8/9] style(pre-commit): autofix --- .github/workflows/dispatch-push-event.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml index c7ffb921f8fd2..11bedb1e4bc51 100644 --- a/.github/workflows/dispatch-push-event.yaml +++ b/.github/workflows/dispatch-push-event.yaml @@ -33,7 +33,7 @@ jobs: app_id: ${{ secrets.INTERNAL_APP_ID }} private_key: ${{ secrets.INTERNAL_PRIVATE_KEY }} - - name: Dispatch the update-beta-branch workflow + - name: Dispatch the update-beta-branch workflow run: | curl -L \ -X POST \ From 0ce8d4b69c799aaa85f65131776d57e583cbde52 Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Thu, 7 Sep 2023 17:50:52 +0900 Subject: [PATCH 9/9] Update .github/workflows/dispatch-push-event.yaml --- .github/workflows/dispatch-push-event.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dispatch-push-event.yaml b/.github/workflows/dispatch-push-event.yaml index 11bedb1e4bc51..492083c8038f6 100644 --- a/.github/workflows/dispatch-push-event.yaml +++ b/.github/workflows/dispatch-push-event.yaml @@ -33,6 +33,7 @@ jobs: app_id: ${{ secrets.INTERNAL_APP_ID }} private_key: ${{ secrets.INTERNAL_PRIVATE_KEY }} + # 注意: workflow_dispatchで指定するブランチはmain固定となっているため、dispatch-repoのmainブランチにupdate-beta-branch.yamlが存在することが前提条件。 - name: Dispatch the update-beta-branch workflow run: | curl -L \