From 0a2e0c5dbed1267f2cfbefcc8f6f09abc60b669d Mon Sep 17 00:00:00 2001 From: na2na-p Date: Tue, 1 Nov 2022 01:03:07 +0900 Subject: [PATCH 1/6] Add actions --- .github/actions/github-app-token/action.yml | 25 ++++++++++++++++++ .github/workflows/approve.yml | 28 +++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/actions/github-app-token/action.yml create mode 100644 .github/workflows/approve.yml diff --git a/.github/actions/github-app-token/action.yml b/.github/actions/github-app-token/action.yml new file mode 100644 index 00000000..306162d9 --- /dev/null +++ b/.github/actions/github-app-token/action.yml @@ -0,0 +1,25 @@ +name: github-app-token +description: github-app-token +inputs: + app_id: + description: app_id + required: true + private_key: + description: private_key + required: true + +outputs: + token: + description: token + value: ${{ steps.token.outputs.token }} + +runs: + using: composite + steps: + - uses: tibdex/github-app-token@v1.7.0 + with: + app_id: ${{ inputs.app_id }} + private_key: ${{ inputs.private_key }} + env: + OPENSSL_CONF: /dev/null + id: token diff --git a/.github/workflows/approve.yml b/.github/workflows/approve.yml new file mode 100644 index 00000000..e0fc7569 --- /dev/null +++ b/.github/workflows/approve.yml @@ -0,0 +1,28 @@ +name: Approve + +on: + pull_request: + types: [review_requested] + +jobs: + approve: + runs-on: ubuntu-latest + timeout-minutes: 1 + if: ${{ github.event.requested_reviewer.login == '2na2-p' }} + env: + GH_TOKEN: ${{ github.token }} + NUMBER: ${{ github.event.number }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Generate github token + id: generate_token + uses: ./.github/actions/github-app-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.PRIVATE_KEY }} + - run: gh pr review $NUMBER --approve + - run: gh pr edit $NUMBER --remove-reviewer $REVIEWER + env: + REVIEWER: ${{ github.event.requested_reviewer.login }} From da59ffe140be95ffc9f7406e0d5f5bac15abdad9 Mon Sep 17 00:00:00 2001 From: na2na-p Date: Tue, 1 Nov 2022 01:12:43 +0900 Subject: [PATCH 2/6] Update --- .github/workflows/approve.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/approve.yml b/.github/workflows/approve.yml index e0fc7569..6effe6fe 100644 --- a/.github/workflows/approve.yml +++ b/.github/workflows/approve.yml @@ -2,13 +2,13 @@ name: Approve on: pull_request: - types: [review_requested] + types: [labeled] jobs: approve: runs-on: ubuntu-latest timeout-minutes: 1 - if: ${{ github.event.requested_reviewer.login == '2na2-p' }} + if: ${{ github.event.label.name == 'Bypass approve' }} env: GH_TOKEN: ${{ github.token }} NUMBER: ${{ github.event.number }} From 20adb1075e4f9d3ea761145379efac4a827be1b6 Mon Sep 17 00:00:00 2001 From: na2na-p Date: Tue, 1 Nov 2022 01:15:10 +0900 Subject: [PATCH 3/6] remove armv7 --- .github/workflows/docker-build-push-2na2-discord.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-push-2na2-discord.yml b/.github/workflows/docker-build-push-2na2-discord.yml index 257fb968..35c297a3 100644 --- a/.github/workflows/docker-build-push-2na2-discord.yml +++ b/.github/workflows/docker-build-push-2na2-discord.yml @@ -40,7 +40,7 @@ jobs: context: . push: true tags: na2na/2na2-discord:${{ github.ref }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: linux/amd64,linux/arm64 cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max # Temp fix From 367d8f1e7aaf1c3ccb81972ca3a87965e72f9ce4 Mon Sep 17 00:00:00 2001 From: na2na-p Date: Tue, 1 Nov 2022 01:17:37 +0900 Subject: [PATCH 4/6] Update --- .github/workflows/approve.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/approve.yml b/.github/workflows/approve.yml index 6effe6fe..7eab387c 100644 --- a/.github/workflows/approve.yml +++ b/.github/workflows/approve.yml @@ -22,7 +22,7 @@ jobs: with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.PRIVATE_KEY }} - - run: gh pr review $NUMBER --approve - - run: gh pr edit $NUMBER --remove-reviewer $REVIEWER - env: - REVIEWER: ${{ github.event.requested_reviewer.login }} + # ghコマンドを利用して自身をreviewerに追加 + - name: Approve + run: | + gh pr review ${{ env.NUMBER }} --approve --token ${{ steps.generate_token.outputs.token }} From fa76650c66d030e9380883fc92fc72b22937b398 Mon Sep 17 00:00:00 2001 From: na2na-p Date: Tue, 1 Nov 2022 01:19:55 +0900 Subject: [PATCH 5/6] Update --- .github/workflows/approve.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/approve.yml b/.github/workflows/approve.yml index 7eab387c..a109d14a 100644 --- a/.github/workflows/approve.yml +++ b/.github/workflows/approve.yml @@ -25,4 +25,5 @@ jobs: # ghコマンドを利用して自身をreviewerに追加 - name: Approve run: | - gh pr review ${{ env.NUMBER }} --approve --token ${{ steps.generate_token.outputs.token }} + gh auth login --with-token ${{ steps.generate_token.outputs.token }} + gh pr review ${{ env.NUMBER }} --approve From 8385bd6091644fef0a773a589fc0be880fe9e794 Mon Sep 17 00:00:00 2001 From: na2na-p Date: Tue, 1 Nov 2022 01:22:25 +0900 Subject: [PATCH 6/6] Update --- .github/workflows/approve.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/approve.yml b/.github/workflows/approve.yml index a109d14a..5ffc764d 100644 --- a/.github/workflows/approve.yml +++ b/.github/workflows/approve.yml @@ -10,7 +10,6 @@ jobs: timeout-minutes: 1 if: ${{ github.event.label.name == 'Bypass approve' }} env: - GH_TOKEN: ${{ github.token }} NUMBER: ${{ github.event.number }} steps: @@ -24,6 +23,6 @@ jobs: private_key: ${{ secrets.PRIVATE_KEY }} # ghコマンドを利用して自身をreviewerに追加 - name: Approve - run: | - gh auth login --with-token ${{ steps.generate_token.outputs.token }} - gh pr review ${{ env.NUMBER }} --approve + run: gh pr review ${{ env.NUMBER }} --approve + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}