-
Notifications
You must be signed in to change notification settings - Fork 26
42 lines (35 loc) · 1.36 KB
/
purge-aws-eks-clusters.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Purge AWS EKS Clusters
on:
schedule:
# Runs every day at 7 AM
- cron: "0 7 * * *"
env:
GH_TOKEN: ${{ github.token }}
AWS_REGION: us-west-2
jobs:
purge_eks_clusters:
name: Purge AWS EKS Clusters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y awscli
- name: Install eksctl
run: |
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
- name: Delete old EKS clusters
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ env.AWS_REGION }}
run: bash .github/scripts/purge-aws-eks-clusters.sh
- name: Create GitHub issue on failure
if: failure() && github.event_name != 'pull_request'
run: |
gh issue create --title "Purge AWS EKS Clusters workflow failed" \
--body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." \
--repo ${{ github.repository }}