From 8cdca288c039ee30fcca97e223a577afa494f78f Mon Sep 17 00:00:00 2001 From: Jan Richter Date: Fri, 16 Feb 2024 16:11:18 +0100 Subject: [PATCH] Bot IDs as inputs for generating access tokens This is a fix for avocado-project tools which use MR. Avocado bot for manipulation with issue and PR. This tool needs MR. Avocados IDs, which is stored in Avocado organization as secrets. Unfortunately, the composite actions cannot use organization secrets, therefore we need to pass them as inputs to the tool. This commit updates the avocado-project action to use MR. Avocados IDs as inputs. Signed-off-by: Jan Richter --- .github/workflows/project.yml | 3 +++ README.md | 12 ++++++++++++ action.yml | 18 +++++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index dfd2224..4b1e330 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -22,3 +22,6 @@ jobs: uses: ./ with: avocado-project: true + bot_app_id: ${{ secrets.MR_AVOCADO_ID }} + bot_app_installation_id: ${{ secrets.MR_AVOCADO_INSTALLATION_ID }} + bot_app_private_key: ${{ secrets.MR_AVOCADO_PRIVATE_KEY }} diff --git a/README.md b/README.md index 64ee8e2..0e4c948 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,18 @@ avocado-static-checks: Mr. avocado configuration for manipulating with PR and issues. Default is false. default: false + bot_app_id: + description: | + Bot app ID which is needed to generate access token for bot. It is required by avocado-project. + default: '' + bot_app_installation_id: + description: | + Bot app installation ID which is needed to generate access token for bot. It is required by avocado-project. + default: '' + bot_app_private_key: + description: | + Bot app private key which is needed to generate access token for bot. It is required by avocado-project. + default: '' ``` ## Usage diff --git a/action.yml b/action.yml index 32c57d6..83ee9d4 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,18 @@ inputs: Mr. avocado configuration for manipulating with PR and issues. Default is false. default: false + bot_app_id: + description: | + Bot app ID which is needed to generate access token for bot. It is required by avocado-project. + default: '' + bot_app_installation_id: + description: | + Bot app installation ID which is needed to generate access token for bot. It is required by avocado-project. + default: '' + bot_app_private_key: + description: | + Bot app private key which is needed to generate access token for bot. It is required by avocado-project. + default: '' runs: using: "composite" steps: @@ -31,9 +43,9 @@ runs: id: generate_token uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c with: - app_id: ${{ secrets.MR_AVOCADO_ID }} - installation_id: ${{ secrets.MR_AVOCADO_INSTALLATION_ID }} - private_key: ${{ secrets.MR_AVOCADO_PRIVATE_KEY }} + app_id: ${{ inputs.bot_app_id }} + installation_id: ${{ inputs.bot_app_installation_id }} + private_key: ${{ inputs.bot_app_private_key }} - if: ${{ inputs.avocado-project == 'true' }} name: Get project data env: