.github/workflows/aks_stop.yaml #1
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: Cron Job Workflow | |
on: | |
schedule: | |
- cron: "0 16 * * 1-5" # Run every weekday at 17:00 | |
jobs: | |
aks_stop: | |
name: "Stop AKS" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Login to Azure | |
run: | | |
az login \ | |
--service-principal \ | |
-u ${{ secrets.AZURE_SERVICE_PRINCIPAL_APP_ID }} \ | |
-p ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }} \ | |
--tenant ${{ secrets.AZURE_TENANT_ID }} | |
- name: Stop AKS | |
run: | | |
az aks stop \ | |
--subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} \ | |
--resource-group "rg${{ secrets.PROJECT }}main${{ secrets.INSTANCE }}" \ | |
--name "aks${{ secrets.PROJECT }}main${{ secrets.INSTANCE }}" \ | |
--no-wait | |
- name: Logout of Azure | |
run: | | |
az logout |