From 9bfb84b0461e68d5bfe0723d55e7963782ee27ad Mon Sep 17 00:00:00 2001 From: Evgeniy Frolov Date: Tue, 17 Dec 2024 11:53:20 +0300 Subject: [PATCH] chore(ci): add cleanup workflow update notification Signed-off-by: Evgeniy Frolov --- .github/workflows/cleanup.yml | 53 ++++++++++++++++++++++++++++++ .github/workflows/notification.yml | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cleanup.yml diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 0000000..211a502 --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,53 @@ +name: cleanup + +on: + workflow_call: + inputs: + werfDir: + required: false + type: string + withoutKube: + required: false + type: string + werfRepo: + required: false + type: string + secrets: + cleanupToken: + description: "cleanup token" + required: true + kubeconfig: + required: false + githubToken: + required: true + + defaults: + run: + shell: bash + +jobs: + cleanup: + name: cleanup + runs-on: ubuntu-latest-16-cores + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install werf + uses: werf/actions/install@v2 + with: + channel: alpha + + - name: Cleanup + run: | + . $(werf ci-env github --as-file) + werf cleanup + env: + WERF_DIR: ${{ inputs.werfDir }} + WERF_WITHOUT_KUBE: ${{ inputs.withoutKube }} + GITHUB_TOKEN: ${{ secrets.githubToken }} + WERF_REPO_GITHUB_TOKEN: ${{ secrets.cleanupToken }} + WERF_KUBE_CONFIG_BASE64: ${{ secrets.kubeconfig }} + WERF_REPO: ${{ inputs.werfRepo }} diff --git a/.github/workflows/notification.yml b/.github/workflows/notification.yml index ed7bf84..515b490 100644 --- a/.github/workflows/notification.yml +++ b/.github/workflows/notification.yml @@ -50,7 +50,7 @@ jobs: Упавшие джобы: ${{ steps.failed_jobs.outputs.failed }} - - if: env.WORKFLOW_CONCLUSION == 'success' + - if: "env.WORKFLOW_CONCLUSION == 'success' && ! startsWith(github.ref, 'refs/pull/') && ! github.event_name == 'workflow_dispatch'" name: Success notify uses: mattermost/action-mattermost-notify@master with: