Purge AWS EKS Clusters #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |