From 8633294a42dad531cdf99eb232d412d1e60f9789 Mon Sep 17 00:00:00 2001 From: Anatolios Laskaris Date: Sun, 24 Nov 2024 19:17:49 +0200 Subject: [PATCH] F --- .github/workflows/create-command.yml | 16 ---------------- .github/workflows/create.yml | 20 ++++++++++++++++++++ .github/workflows/destroy-command.yml | 16 ---------------- .github/workflows/help-command.yml | 23 ----------------------- .github/workflows/reset-command.yml | 16 ---------------- .github/workflows/slash.yml | 20 -------------------- .github/workflows/terraform.yml | 9 +++------ 7 files changed, 23 insertions(+), 97 deletions(-) delete mode 100644 .github/workflows/create-command.yml create mode 100644 .github/workflows/create.yml delete mode 100644 .github/workflows/destroy-command.yml delete mode 100644 .github/workflows/help-command.yml delete mode 100644 .github/workflows/reset-command.yml delete mode 100644 .github/workflows/slash.yml diff --git a/.github/workflows/create-command.yml b/.github/workflows/create-command.yml deleted file mode 100644 index 4650f10b..00000000 --- a/.github/workflows/create-command.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: create-command - -on: - repository_dispatch: - types: [create-command] - -jobs: - create: - uses: ./.github/workflows/terraform.yml - with: - command: ${{ github.event.client_payload.slash_command.command }} - branch: ${{ github.event.client_payload.pull_request.head.ref }} - sha: ${{ github.event.client_payload.pull_request.head.sha }} - workspace: "spectrum-${{ github.event.client_payload.pull_request.head.ref }}" - secrets: - PAT: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }} diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml new file mode 100644 index 00000000..da2905cd --- /dev/null +++ b/.github/workflows/create.yml @@ -0,0 +1,20 @@ +name: "create" + +on: + pull_request: + types: + - "labeled" + - "synchronize" + - "opened" + - "reopened" + +jobs: + k8s: + if: > + contains(github.event.pull_request.labels.*.name, 'ephemeral') && + !github.event.pull_request.head.repo.fork + with: + command: create + workspace: "spectrum-${{ github.head_ref }}" + secrets: + PAT: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }} diff --git a/.github/workflows/destroy-command.yml b/.github/workflows/destroy-command.yml deleted file mode 100644 index 679a0daa..00000000 --- a/.github/workflows/destroy-command.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: destroy-command - -on: - repository_dispatch: - types: [destroy-command] - -jobs: - destroy: - uses: ./.github/workflows/terraform.yml - with: - command: ${{ github.event.client_payload.slash_command.command }} - branch: ${{ github.event.client_payload.pull_request.head.ref }} - sha: ${{ github.event.client_payload.pull_request.head.sha }} - workspace: "spectrum-${{ github.event.client_payload.pull_request.head.ref }}" - secrets: - PAT: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }} diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml deleted file mode 100644 index 759eb390..00000000 --- a/.github/workflows/help-command.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: help-command - -on: - repository_dispatch: - types: [help-command] - -jobs: - help: - runs-on: ubuntu-latest - steps: - - name: Update comment - uses: peter-evans/create-or-update-comment@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.github.payload.repository.full_name }} - comment-id: ${{ github.event.client_payload.github.payload.comment.id }} - body: | - > Command | Description - > --- | --- - > /help | List available commands - > /create | Create and bootstrap talos cluster - > /destroy | Destroy talos cluster and all resources - > /reset | Recreate talos cluster (destroy && create) diff --git a/.github/workflows/reset-command.yml b/.github/workflows/reset-command.yml deleted file mode 100644 index 0c1c99e2..00000000 --- a/.github/workflows/reset-command.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: reset-command - -on: - repository_dispatch: - types: [reset-command] - -jobs: - reset: - uses: ./.github/workflows/terraform.yml - with: - command: ${{ github.event.client_payload.slash_command.command }} - branch: ${{ github.event.client_payload.pull_request.head.ref }} - sha: ${{ github.event.client_payload.pull_request.head.sha }} - workspace: "spectrum-${{ github.event.client_payload.pull_request.head.ref }}" - secrets: - PAT: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }} diff --git a/.github/workflows/slash.yml b/.github/workflows/slash.yml deleted file mode 100644 index ca2d6030..00000000 --- a/.github/workflows/slash.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: slash command - -on: - issue_comment: - types: [created] - -jobs: - command: - runs-on: ubuntu-latest - steps: - - name: Slash Command Dispatch - uses: peter-evans/slash-command-dispatch@v4 - with: - token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }} - issue-type: pull-request - commands: | - create - reset - destroy - help diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 094f4846..5915cb68 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -87,8 +87,7 @@ jobs: id: comment with: token: ${{ secrets.PAT }} - repository: "${{ github.event.client_payload.repository || github.repository }}" - issue-number: "${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}" + issue-number: "${{ github.event.pull_request.number }}" comment-author: fluencebot body-includes: "## ephemeral: ${{ steps.sanitize.outputs.workspace }}" @@ -98,8 +97,7 @@ jobs: with: comment-id: "${{ steps.comment.outputs.comment-id }}" token: ${{ secrets.PAT }} - repository: "${{ github.event.pull_request.repository || github.event.client_payload.pull_request.repository }}" - issue-number: "${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}" + issue-number: "${{ github.event.pull_request.number }}" comment-author: fluencebot body: | ## ephemeral: ${{ steps.sanitize.outputs.workspace }} @@ -157,8 +155,7 @@ jobs: with: comment-id: "${{ steps.comment.outputs.comment-id }}" token: ${{ secrets.PAT }} - repository: "${{ github.event.pull_request.repository || github.event.client_payload.pull_request.repository }}" - issue-number: "${{ github.event.pull_request.number || github.event.client_payload.pull_request.number }}" + issue-number: "${{ github.event.pull_request.number }}" comment-author: fluencebot body: | ## ephemeral: ${{ steps.sanitize.outputs.workspace }}