From daa55cad628c2fbba1942b5d71a0cb75c73321cc Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 27 Jun 2024 09:59:05 +0200 Subject: [PATCH 01/12] feat(deploy-my-kibana): use github secrets --- oblt-cli/deploy-my-kibana/README.md | 35 +++++++++ oblt-cli/deploy-my-kibana/action.yml | 105 +++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 oblt-cli/deploy-my-kibana/README.md create mode 100644 oblt-cli/deploy-my-kibana/action.yml diff --git a/oblt-cli/deploy-my-kibana/README.md b/oblt-cli/deploy-my-kibana/README.md new file mode 100644 index 00000000..55aaa97a --- /dev/null +++ b/oblt-cli/deploy-my-kibana/README.md @@ -0,0 +1,35 @@ +# oblt-cli/deploy-my-kibana + +[![usages](https://img.shields.io/badge/usages-white?logo=githubactions&logoColor=blue)](https://github.com/search?q=elastic%2Foblt-actions%2Foblt-cli%2Fdeploy-my-kibana+%28path%3A.github%2Fworkflows+OR+path%3A**%2Faction.yml+OR+path%3A**%2Faction.yaml%29&type=code) + + +Run the deploy my Kibana PR. + + +## Inputs + +| Name | Description | Required | Default | +|----------------|---------------------------------------------|----------|-----------------------------------------| +| `comment-url` | The GitHub Comment URL | `false` | `${{ github.event.comment.html_url }}` | +| `comment-id` | The GitHub Comment ID | `false` | `${{ github.event.comment.id }}` | +| `github-token` | The GitHub access token. | `true` | ` ` | +| `issue-url` | The GitHub Issue URL | `false` | `${{ github.event.comment.issue_url }}` | +| `repository` | The GitHub repository | `false` | `${{ github.repository }}` | +| `user` | The GitHub user that triggered the workflow | `false` | `${{ github.triggering_actor }}` | + + +## Usage + +```yaml +on: + issue_comment: + types: [created] +jobs: + deploy-my-kibana: + runs-on: ubuntu-latest + steps: + - uses: elastic/oblt-actions/oblt-cli/deploy-my-kibana@v1 + with: + github-token: ${{ secrets.PAT_TOKEN }} +``` + diff --git a/oblt-cli/deploy-my-kibana/action.yml b/oblt-cli/deploy-my-kibana/action.yml new file mode 100644 index 00000000..dc5bf4d1 --- /dev/null +++ b/oblt-cli/deploy-my-kibana/action.yml @@ -0,0 +1,105 @@ +name: 'oblt-cli/deploy-my-kibana' +description: 'Run the deploy my Kibana PR.' +inputs: + comment-url: + description: 'The GitHub Comment URL' + default: ${{ github.event.comment.html_url }} + comment-id: + description: 'The GitHub Comment ID' + default: ${{ github.event.comment.id }} + github-token: + description: 'The GitHub access token.' + required: true + issue-url: + description: 'The GitHub Issue URL' + default: ${{ github.event.comment.issue_url }} + repository: + description: 'The GitHub repository' + default: ${{ github.repository }} + user: + description: 'The GitHub user that triggered the workflow' + default: ${{ github.triggering_actor }} +runs: + using: "composite" + steps: + - uses: elastic/apm-pipeline-library/.github/actions/comment-reaction@current + with: + repository: ${{ inputs.repository }} + commentId: ${{ inputs.comment-id }} + token: ${{ inputs.github-token }} + + - name: Is an Elastician comment? + id: is_elastic_member + uses: elastic/apm-pipeline-library/.github/actions/is-member-elastic-org@current + with: + username: ${{ inputs.user }} + token: ${{ inputs.github-token }} + + - name: Get cluster given the target branch (either edge-lite or release) + if: contains(steps.is_elastic_member.outputs.result, 'true') + run: |- + PR=$(basename ${{ inputs.issue-url }}) + echo "PR=${PR}" >> $GITHUB_ENV + + # issue_comment does not contain any references to github.base_ref + TARGET_BRANCH=$(gh pr view ${PR} --repo ${{ inputs.repository }} --json baseRefName --jq .baseRefName) + + if [ "${TARGET_BRANCH}" == 'main' ] ; then + echo "CLUSTER=edge-lite-oblt" >> $GITHUB_ENV + else + echo "CLUSTER=release-oblt" >> $GITHUB_ENV + fi + shell: bash + env: + GH_TOKEN: ${{ inputs.github-token }} + + - name: Create github issue body + if: contains(steps.is_elastic_member.outputs.result, 'true') + run: |- + cat <> .body-content + ### From cluster + + ${{ env.CLUSTER }} + + ### Kibana branch + + pr/${{ env.PR }} + + ### Custom prefix (Optional) + + _No response_ + + ### Oblt-cli user (Optional) + + deploykibana + + ### Further details + + Caused by @${{ inputs.user }} in ${{ inputs.comment-url }} + EOT + shell: bash + + - name: Create github issue for the deploy-my-kibana + if: contains(steps.is_elastic_member.outputs.result, 'true') + run: | + gh issue \ + create \ + --label 'deploy-custom-kibana' \ + --title "[Deploy Kibana] for user ${{ inputs.user }} with PR kibana@pr-${{ env.PR }} on cluster ${{ env.CLUSTER }}" \ + --assignee ${{ inputs.user }} \ + --body-file .body-content \ + --repo elastic/observability-test-environments | tee .issue + echo "ISSUE=$(cat .issue)" >> $GITHUB_ENV + echo "issue=$ISSUE" >> "$GITHUB_OUTPUT" + env: + GH_TOKEN: ${{ inputs.github-token }} + shell: bash + + - name: Notify with a reaction if a non-elastician comment + uses: elastic/apm-pipeline-library/.github/actions/comment-reaction@current + if: contains(steps.is_elastic_member.outputs.result, 'false') + with: + repository: ${{ inputs.repository }} + commentId: ${{ inputs.comment-id }} + emoji: '-1' + token: ${{ inputs.github-token }} From acbf90a8eacf886b5c918206ce346a477d402b16 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 7 Oct 2024 22:35:38 +0200 Subject: [PATCH 02/12] use github app and add e2e tests --- .../test-oblt-cli-deploy-my-kibana.yml | 69 +++++++++++++ oblt-cli/deploy-my-kibana/README.md | 27 +++-- oblt-cli/deploy-my-kibana/action.yml | 99 +++++++++++++------ 3 files changed, 155 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/test-oblt-cli-deploy-my-kibana.yml diff --git a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml new file mode 100644 index 00000000..221428ec --- /dev/null +++ b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml @@ -0,0 +1,69 @@ +name: test-deploy-my-kibana + +on: + pull_request: + branches: + - main + paths: + - '.github/workflows/test-deploy-my-kibana.yml' + - 'oblt-cli/deploy-my-kibana/**' + push: + branches: + - main + paths: + - '.github/workflows/test-deploy-my-kibana.yml' + - 'oblt-cli/deploy-my-kibana/**' + +permissions: + contents: read + +jobs: + deploy-my-kibana: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: ./oblt-cli/deploy-my-kibana + with: + github-app-id: ${{ secrets.OBS_AUTOMATION_APP_ID }} + github-app-private-key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} + pull-request: '195219' + repository: 'elastic/kibana' + + no-parameters: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./oblt-cli/deploy-my-kibana + id: validation + continue-on-error: true + - name: Assert is failure if no parameters + run: test "${{steps.validation.outcome}}" = "failure" + + all-parameters: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./oblt-cli/deploy-my-kibana + id: validation + continue-on-error: true + with: + github-app-id: "app" + github-app-private-key: "key" + github-token: "foo" + - name: Assert is failure if all parameters + run: test "${{steps.validation.outcome}}" = "failure" + + test: + if: always() + needs: + - deploy-my-kibana + - no-parameters + - all-parameters + runs-on: ubuntu-latest + steps: + - id: check + uses: elastic/oblt-actions/check-dependent-jobs@v1 + with: + jobs: ${{ toJSON(needs) }} + - run: ${{ steps.check.outputs.is-success }} diff --git a/oblt-cli/deploy-my-kibana/README.md b/oblt-cli/deploy-my-kibana/README.md index 55aaa97a..2a22478d 100644 --- a/oblt-cli/deploy-my-kibana/README.md +++ b/oblt-cli/deploy-my-kibana/README.md @@ -1,6 +1,8 @@ # oblt-cli/deploy-my-kibana [![usages](https://img.shields.io/badge/usages-white?logo=githubactions&logoColor=blue)](https://github.com/search?q=elastic%2Foblt-actions%2Foblt-cli%2Fdeploy-my-kibana+%28path%3A.github%2Fworkflows+OR+path%3A**%2Faction.yml+OR+path%3A**%2Faction.yaml%29&type=code) +[![test-oblt-cli-deploy-my-kibana](https://github.com/elastic/oblt-actions/actions/workflows/test-oblt-cli-deploy-my-kibana.yml/badge.svg?branch=main)](https://github.com/elastic/oblt-actions/actions/workflows/test-oblt-cli-deploy-my-kibana.yml) + Run the deploy my Kibana PR. @@ -8,16 +10,25 @@ Run the deploy my Kibana PR. ## Inputs -| Name | Description | Required | Default | -|----------------|---------------------------------------------|----------|-----------------------------------------| -| `comment-url` | The GitHub Comment URL | `false` | `${{ github.event.comment.html_url }}` | -| `comment-id` | The GitHub Comment ID | `false` | `${{ github.event.comment.id }}` | -| `github-token` | The GitHub access token. | `true` | ` ` | -| `issue-url` | The GitHub Issue URL | `false` | `${{ github.event.comment.issue_url }}` | -| `repository` | The GitHub repository | `false` | `${{ github.repository }}` | -| `user` | The GitHub user that triggered the workflow | `false` | `${{ github.triggering_actor }}` | +| Name | Description | Required | Default | +|--------------------------|-------------------------------------------------------------|----------|-----------------------------------------| +| `comment-url` | The GitHub Comment URL | `false` | `${{ github.event.comment.html_url }}` | +| `comment-id` | The GitHub Comment ID | `false` | `${{ github.event.comment.id }}` | +| `issue-url` | The GitHub Issue URL | `false` | `${{ github.event.comment.issue_url }}` | +| `repository` | The GitHub repository | `false` | `${{ github.repository }}` | +| `user` | The GitHub user that triggered the workflow | `false` | `${{ github.triggering_actor }}` | +| `github-token` | The GitHub Personal Access Token. | `false` | ` ` | +| `github-app-id` | The GitHub App ID to generate the ephemeral token. | `false` | ` ` | +| `github-app-private-key` | The GitHub App Private Key to generate the ephemeral token. | `false` | ` ` | +## Output + +| Name | Description | +|---------|---------------------------------------------------------------| +| `issue` | The GitHub issue that has been created to destroy the cluster | + + ## Usage ```yaml diff --git a/oblt-cli/deploy-my-kibana/action.yml b/oblt-cli/deploy-my-kibana/action.yml index dc5bf4d1..215be463 100644 --- a/oblt-cli/deploy-my-kibana/action.yml +++ b/oblt-cli/deploy-my-kibana/action.yml @@ -7,9 +7,6 @@ inputs: comment-id: description: 'The GitHub Comment ID' default: ${{ github.event.comment.id }} - github-token: - description: 'The GitHub access token.' - required: true issue-url: description: 'The GitHub Issue URL' default: ${{ github.event.comment.issue_url }} @@ -19,21 +16,67 @@ inputs: user: description: 'The GitHub user that triggered the workflow' default: ${{ github.triggering_actor }} + github-token: + description: 'The GitHub Personal Access Token.' + required: false + github-app-id: + description: 'The GitHub App ID to generate the ephemeral token.' + required: false + github-app-private-key: + description: 'The GitHub App Private Key to generate the ephemeral token.' + required: false + +outputs: + issue: + description: 'The GitHub issue that has been created to destroy the cluster' + value: ${{ steps.deploy-my-kibana.outputs.issue }} + runs: using: "composite" steps: - - uses: elastic/apm-pipeline-library/.github/actions/comment-reaction@current + # TODO: need to be implemented + # - uses: elastic/oblt-actions/github/comment-reaction@v1 + # with: + # repository: ${{ inputs.repository }} + # comment-id: ${{ inputs.comment-id }} + # github-token: ${{ inputs.github-token }} + + - if: ${{ (inputs.github-token == '' && inputs.github-app-id == '' && inputs.github-app-private-key == '') || (inputs.github-token != '' && inputs.github-app-id != '' && inputs.github-app-private-key != '') }} + name: Validate input parameters + run: echo "use either github-token or github-app-id and github-app-private-key" && exit 1 + shell: bash + + - name: Get token + if: ${{ inputs.github-token == '' }} + id: get_token + uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 with: - repository: ${{ inputs.repository }} - commentId: ${{ inputs.comment-id }} - token: ${{ inputs.github-token }} + app_id: ${{ inputs.github-app-id }} + private_key: ${{ inputs.github-app-private-key }} + permissions: >- + { + "contents": "read", + "issues": "write", + "members": "read" + } + # As long as we use members: read we cannot use the repositories input. + + - if: ${{ inputs.github-token == '' }} + name: If ephemeral GitHub token app generated + run: echo "GH_TOKEN=${{ steps.get_token.outputs.token }}" >> "$GITHUB_ENV" + shell: bash - - name: Is an Elastician comment? + - if: ${{ inputs.github-token != '' }} + name: If GitHub token provided + run: echo "GH_TOKEN=${{ inputs.github-token }}" >> "$GITHUB_ENV" + shell: bash + + - uses: elastic/oblt-actions/github/is-member-of@v1 id: is_elastic_member - uses: elastic/apm-pipeline-library/.github/actions/is-member-elastic-org@current with: - username: ${{ inputs.user }} - token: ${{ inputs.github-token }} + github-user: ${{ inputs.user }} + github-org: "elastic" + github-token: ${{ env.GH_TOKEN }} - name: Get cluster given the target branch (either edge-lite or release) if: contains(steps.is_elastic_member.outputs.result, 'true') @@ -50,11 +93,10 @@ runs: echo "CLUSTER=release-oblt" >> $GITHUB_ENV fi shell: bash - env: - GH_TOKEN: ${{ inputs.github-token }} - - name: Create github issue body + - name: Create GitHub issue if: contains(steps.is_elastic_member.outputs.result, 'true') + id: deploy-my-kibana run: |- cat <> .body-content ### From cluster @@ -75,13 +117,8 @@ runs: ### Further details - Caused by @${{ inputs.user }} in ${{ inputs.comment-url }} + Caused by @${{ inputs.user }} in ${{ inputs.comment-url }} via this [GitHub workflow build](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}) EOT - shell: bash - - - name: Create github issue for the deploy-my-kibana - if: contains(steps.is_elastic_member.outputs.result, 'true') - run: | gh issue \ create \ --label 'deploy-custom-kibana' \ @@ -89,17 +126,15 @@ runs: --assignee ${{ inputs.user }} \ --body-file .body-content \ --repo elastic/observability-test-environments | tee .issue - echo "ISSUE=$(cat .issue)" >> $GITHUB_ENV - echo "issue=$ISSUE" >> "$GITHUB_OUTPUT" - env: - GH_TOKEN: ${{ inputs.github-token }} + echo "issue=$(cat .issue)" >> "$GITHUB_OUTPUT" shell: bash - - name: Notify with a reaction if a non-elastician comment - uses: elastic/apm-pipeline-library/.github/actions/comment-reaction@current - if: contains(steps.is_elastic_member.outputs.result, 'false') - with: - repository: ${{ inputs.repository }} - commentId: ${{ inputs.comment-id }} - emoji: '-1' - token: ${{ inputs.github-token }} + # TODO: need to be implemented + # - name: Notify with a reaction if a non-elastician comment + # uses: elastic/oblt-actions/github/comment-reaction@v1 + # if: contains(steps.is_elastic_member.outputs.result, 'false') + # with: + # repository: ${{ inputs.repository }} + # comment-id: ${{ inputs.comment-id }} + # emoji: '-1' + # github-token: ${{ inputs.github-token }} From bea18de0eb81f4d2ed59e5b778f7df5e290396ab Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 7 Oct 2024 22:36:53 +0200 Subject: [PATCH 03/12] use my PR and change cosmetic badge --- .github/workflows/test-oblt-cli-undeploy-my-kibana.yml | 2 +- oblt-cli/undeploy-my-kibana/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-oblt-cli-undeploy-my-kibana.yml b/.github/workflows/test-oblt-cli-undeploy-my-kibana.yml index b332b8d3..d7f0d326 100644 --- a/.github/workflows/test-oblt-cli-undeploy-my-kibana.yml +++ b/.github/workflows/test-oblt-cli-undeploy-my-kibana.yml @@ -27,7 +27,7 @@ jobs: with: github-app-id: ${{ secrets.OBS_AUTOMATION_APP_ID }} github-app-private-key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} - pull-request: '187489' + pull-request: '195219' repository: 'elastic/kibana' no-parameters: diff --git a/oblt-cli/undeploy-my-kibana/README.md b/oblt-cli/undeploy-my-kibana/README.md index 7cd6ee74..c20d6b6b 100644 --- a/oblt-cli/undeploy-my-kibana/README.md +++ b/oblt-cli/undeploy-my-kibana/README.md @@ -1,7 +1,7 @@ # oblt-cli/undeploy-my-kibana [![usages](https://img.shields.io/badge/usages-white?logo=githubactions&logoColor=blue)](https://github.com/search?q=elastic%2Foblt-actions%2Foblt-cli%2Fundeploy-my-kibana+%28path%3A.github%2Fworkflows+OR+path%3A**%2Faction.yml+OR+path%3A**%2Faction.yaml%29&type=code) -[![test-oblt-cli-cluster-name-validation](https://github.com/elastic/oblt-actions/actions/workflows/test-oblt-cli-undeploy-my-kibana.yml/badge.svg?branch=main)](https://github.com/elastic/oblt-actions/actions/workflows/test-oblt-cli-undeploy-my-kibana.yml) +[![test-oblt-cli-undeploy-my-kibana](https://github.com/elastic/oblt-actions/actions/workflows/test-oblt-cli-undeploy-my-kibana.yml/badge.svg?branch=main)](https://github.com/elastic/oblt-actions/actions/workflows/test-oblt-cli-undeploy-my-kibana.yml) Undeploy my kibana given the Pull Request From 7ee060771fcfbe5c5a5e55d611cd52988ca505b1 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 7 Oct 2024 22:44:59 +0200 Subject: [PATCH 04/12] mimic a github comment --- .github/workflows/test-oblt-cli-deploy-my-kibana.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml index 221428ec..66a06ab6 100644 --- a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml +++ b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml @@ -27,7 +27,9 @@ jobs: with: github-app-id: ${{ secrets.OBS_AUTOMATION_APP_ID }} github-app-private-key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} - pull-request: '195219' + comment_url: https://github.com/elastic/kibana/pull/195219#issuecomment-2397814616 + comment_id: 2397814616 + issue_url: https://api.github.com/repos/elastic/kibana/issues/195219 repository: 'elastic/kibana' no-parameters: From e8e3a06d4a1821d180b6927db9133c780d251b41 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 7 Oct 2024 22:47:28 +0200 Subject: [PATCH 05/12] fix --- .github/workflows/test-oblt-cli-deploy-my-kibana.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml index 66a06ab6..0715416e 100644 --- a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml +++ b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml @@ -27,9 +27,9 @@ jobs: with: github-app-id: ${{ secrets.OBS_AUTOMATION_APP_ID }} github-app-private-key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} - comment_url: https://github.com/elastic/kibana/pull/195219#issuecomment-2397814616 - comment_id: 2397814616 - issue_url: https://api.github.com/repos/elastic/kibana/issues/195219 + comment-url: https://github.com/elastic/kibana/pull/195219#issuecomment-2397814616 + comment-id: 2397814616 + issue-url: https://api.github.com/repos/elastic/kibana/issues/195219 repository: 'elastic/kibana' no-parameters: From 5f858e67258f2224f7530707acf2df69f300ddcf Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 7 Oct 2024 23:35:50 +0200 Subject: [PATCH 06/12] use gh reactions --- .../test-oblt-cli-deploy-my-kibana.yml | 1 + oblt-cli/deploy-my-kibana/README.md | 5 ++++ oblt-cli/deploy-my-kibana/action.yml | 30 +++++++++---------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml index 0715416e..e4dcaad6 100644 --- a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml +++ b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml @@ -16,6 +16,7 @@ on: permissions: contents: read + pull-requests: write jobs: deploy-my-kibana: diff --git a/oblt-cli/deploy-my-kibana/README.md b/oblt-cli/deploy-my-kibana/README.md index 2a22478d..8fd6ac6f 100644 --- a/oblt-cli/deploy-my-kibana/README.md +++ b/oblt-cli/deploy-my-kibana/README.md @@ -38,6 +38,11 @@ on: jobs: deploy-my-kibana: runs-on: ubuntu-latest + permissions: + # if you listen for PRs, use this to use some comment reactions + pull-requests: write + # if you listen for issues, use this to use some comment reactions + issues: write steps: - uses: elastic/oblt-actions/oblt-cli/deploy-my-kibana@v1 with: diff --git a/oblt-cli/deploy-my-kibana/action.yml b/oblt-cli/deploy-my-kibana/action.yml index 215be463..a1b88997 100644 --- a/oblt-cli/deploy-my-kibana/action.yml +++ b/oblt-cli/deploy-my-kibana/action.yml @@ -34,12 +34,11 @@ outputs: runs: using: "composite" steps: - # TODO: need to be implemented - # - uses: elastic/oblt-actions/github/comment-reaction@v1 - # with: - # repository: ${{ inputs.repository }} - # comment-id: ${{ inputs.comment-id }} - # github-token: ${{ inputs.github-token }} + - uses: elastic/oblt-actions/github/comment-reaction@v1 + with: + repository: ${{ inputs.repository }} + comment-id: ${{ inputs.comment-id }} + github-token: ${{ github.token }} - if: ${{ (inputs.github-token == '' && inputs.github-app-id == '' && inputs.github-app-private-key == '') || (inputs.github-token != '' && inputs.github-app-id != '' && inputs.github-app-private-key != '') }} name: Validate input parameters @@ -56,7 +55,7 @@ runs: permissions: >- { "contents": "read", - "issues": "write", + "pull_requests": "write", "members": "read" } # As long as we use members: read we cannot use the repositories input. @@ -129,12 +128,11 @@ runs: echo "issue=$(cat .issue)" >> "$GITHUB_OUTPUT" shell: bash - # TODO: need to be implemented - # - name: Notify with a reaction if a non-elastician comment - # uses: elastic/oblt-actions/github/comment-reaction@v1 - # if: contains(steps.is_elastic_member.outputs.result, 'false') - # with: - # repository: ${{ inputs.repository }} - # comment-id: ${{ inputs.comment-id }} - # emoji: '-1' - # github-token: ${{ inputs.github-token }} + - name: Notify with a reaction if a non-elastician comment + uses: elastic/oblt-actions/github/comment-reaction@v1 + if: contains(steps.is_elastic_member.outputs.result, 'false') + with: + repository: ${{ inputs.repository }} + comment-id: ${{ inputs.comment-id }} + emoji: '-1' + github-token: ${{ github.token }} From fb7f1b951c4e1a0c7662cbca8de9cb4db20340d3 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 7 Oct 2024 23:45:07 +0200 Subject: [PATCH 07/12] use the same repository for testing purposes --- .github/workflows/test-oblt-cli-deploy-my-kibana.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml index e4dcaad6..5cd202d9 100644 --- a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml +++ b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml @@ -28,10 +28,10 @@ jobs: with: github-app-id: ${{ secrets.OBS_AUTOMATION_APP_ID }} github-app-private-key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} - comment-url: https://github.com/elastic/kibana/pull/195219#issuecomment-2397814616 - comment-id: 2397814616 - issue-url: https://api.github.com/repos/elastic/kibana/issues/195219 - repository: 'elastic/kibana' + comment-url: https://github.com/elastic/oblt-actions/pull/59#issuecomment-2213186823 + comment-id: 2213186823 + issue-url: https://api.github.com/repos/elastic/oblt-actions/issues/195219 + repository: 'elastic/oblt-actions' no-parameters: runs-on: ubuntu-latest From 18495b8911f53b1ebc3352c9c2f4ebf469ccbe49 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 7 Oct 2024 23:46:02 +0200 Subject: [PATCH 08/12] fix --- .github/workflows/test-oblt-cli-deploy-my-kibana.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml index 5cd202d9..a1cb7129 100644 --- a/.github/workflows/test-oblt-cli-deploy-my-kibana.yml +++ b/.github/workflows/test-oblt-cli-deploy-my-kibana.yml @@ -30,7 +30,7 @@ jobs: github-app-private-key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} comment-url: https://github.com/elastic/oblt-actions/pull/59#issuecomment-2213186823 comment-id: 2213186823 - issue-url: https://api.github.com/repos/elastic/oblt-actions/issues/195219 + issue-url: https://api.github.com/repos/elastic/oblt-actions/issues/59 repository: 'elastic/oblt-actions' no-parameters: From 29fcd5d0be746ba757edabb8280b094cb2449096 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 7 Oct 2024 23:47:28 +0200 Subject: [PATCH 09/12] fix --- oblt-cli/deploy-my-kibana/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oblt-cli/deploy-my-kibana/action.yml b/oblt-cli/deploy-my-kibana/action.yml index a1b88997..981716b3 100644 --- a/oblt-cli/deploy-my-kibana/action.yml +++ b/oblt-cli/deploy-my-kibana/action.yml @@ -55,7 +55,7 @@ runs: permissions: >- { "contents": "read", - "pull_requests": "write", + "issues": "write", "members": "read" } # As long as we use members: read we cannot use the repositories input. From c0e6a9f9506e7a5563ae70dd1a95f57041561f63 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 8 Oct 2024 00:06:24 +0200 Subject: [PATCH 10/12] use the installation retrieve id --- oblt-cli/deploy-my-kibana/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/oblt-cli/deploy-my-kibana/action.yml b/oblt-cli/deploy-my-kibana/action.yml index 981716b3..8b1a1f29 100644 --- a/oblt-cli/deploy-my-kibana/action.yml +++ b/oblt-cli/deploy-my-kibana/action.yml @@ -52,6 +52,7 @@ runs: with: app_id: ${{ inputs.github-app-id }} private_key: ${{ inputs.github-app-private-key }} + installation_retrieval_mode: id permissions: >- { "contents": "read", From 9f3014c53fd3561d58a7c764acacf2b6567392e0 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 8 Oct 2024 00:12:14 +0200 Subject: [PATCH 11/12] test --- oblt-cli/deploy-my-kibana/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/oblt-cli/deploy-my-kibana/action.yml b/oblt-cli/deploy-my-kibana/action.yml index 8b1a1f29..afc778d0 100644 --- a/oblt-cli/deploy-my-kibana/action.yml +++ b/oblt-cli/deploy-my-kibana/action.yml @@ -53,6 +53,7 @@ runs: app_id: ${{ inputs.github-app-id }} private_key: ${{ inputs.github-app-private-key }} installation_retrieval_mode: id + installation_retrieval_payload: ${{ inputs.github-app-id }} permissions: >- { "contents": "read", From fd45df8abd6ca01851f85ad230661ae14069e0b1 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 8 Oct 2024 00:14:09 +0200 Subject: [PATCH 12/12] test --- oblt-cli/deploy-my-kibana/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oblt-cli/deploy-my-kibana/action.yml b/oblt-cli/deploy-my-kibana/action.yml index afc778d0..54016875 100644 --- a/oblt-cli/deploy-my-kibana/action.yml +++ b/oblt-cli/deploy-my-kibana/action.yml @@ -52,8 +52,8 @@ runs: with: app_id: ${{ inputs.github-app-id }} private_key: ${{ inputs.github-app-private-key }} - installation_retrieval_mode: id - installation_retrieval_payload: ${{ inputs.github-app-id }} + installation_retrieval_mode: organization + installation_retrieval_payload: elastic permissions: >- { "contents": "read",