From 210f727f0103f4ed66b5ef845417d5bcface5367 Mon Sep 17 00:00:00 2001 From: Shumpei Wakabayashi <42209144+shmpwk@users.noreply.github.com> Date: Fri, 10 Mar 2023 22:09:01 +0900 Subject: [PATCH 1/2] ci: dispatch release note repository (#313) Signed-off-by: Shumpei Wakabayashi --- .github/workflows/dispatch-release-note.yaml | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/dispatch-release-note.yaml diff --git a/.github/workflows/dispatch-release-note.yaml b/.github/workflows/dispatch-release-note.yaml new file mode 100644 index 0000000000000..690b2fedbbff5 --- /dev/null +++ b/.github/workflows/dispatch-release-note.yaml @@ -0,0 +1,39 @@ +name: dispatch-release-note +on: + push: + branches: + - beta/v* + - tier4/main + tags: + - v* + workflow_dispatch: + inputs: + beta-branch-or-tag-name: + description: The name of the beta branch or tag to write release note + type: string + required: true +jobs: + dispatch-release-note: + runs-on: ubuntu-latest + name: release-repository-dispatch + steps: + - name: Set tag name + id: set-tag-name + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + REF_NAME="${{ github.event.inputs.beta-branch-or-tag-name }}" + else + REF_NAME="${{ github.ref_name }}" + fi + echo ::set-output name=ref-name::"$REF_NAME" + echo ::set-output name=tag-name::"${REF_NAME#beta/}" + + - name: Repository dispatch for release note + run: | + curl \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/tier4/update-release-notes/dispatches" \ + -d '{"event_type":"${{ steps.set-tag-name.outputs.ref-name }}"}' From 42adf0f8be60a974311556d40b6598f0b0c19292 Mon Sep 17 00:00:00 2001 From: Shumpei Wakabayashi <42209144+shmpwk@users.noreply.github.com> Date: Tue, 14 Mar 2023 17:58:47 +0900 Subject: [PATCH 2/2] ci(dispatch-release-note): use Github Apps instead of GIHUB_TOKEN (#315) * ci(dispatch-release-note): use Github Apps instead of GIHUB_TOKEN Signed-off-by: Shumpei Wakabayashi * fix typo * chore: remove white space Signed-off-by: Shumpei Wakabayashi --------- Signed-off-by: Shumpei Wakabayashi Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> --- .github/workflows/dispatch-release-note.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dispatch-release-note.yaml b/.github/workflows/dispatch-release-note.yaml index 690b2fedbbff5..0245e2b929cd8 100644 --- a/.github/workflows/dispatch-release-note.yaml +++ b/.github/workflows/dispatch-release-note.yaml @@ -28,12 +28,19 @@ jobs: echo ::set-output name=ref-name::"$REF_NAME" echo ::set-output name=tag-name::"${REF_NAME#beta/}" + - name: Generate token + id: generate-token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.PRIVATE_KEY }} + - name: Repository dispatch for release note run: | curl \ -X POST \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Authorization: token ${{ steps.generate-token.outputs.token }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/repos/tier4/update-release-notes/dispatches" \ -d '{"event_type":"${{ steps.set-tag-name.outputs.ref-name }}"}'