Clean Azure Container Registry #62
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: Clean Azure Container Registry | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * MON" | |
jobs: | |
clean: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Disable workflow | |
run: | | |
curl -X PUT -H "Authorization: token ${{ secrets.APK_BOT_TOKEN }}" \ | |
https://api.github.com/repos/wso2/apk/actions/workflows/49589306/disable | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Login to AZURE AND DELETE | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: 2.44.1 | |
inlineScript: | | |
for repo in $(az acr repository list --name ${{ secrets.AZURE_ACR_NAME }} --output tsv); do | |
az acr repository delete --name ${{ secrets.AZURE_ACR_NAME }} --repository $repo --yes | |
done | |
- name: Enable workflow | |
if: always() | |
run: | | |
curl -X PUT -H "Authorization: token ${{ secrets.APK_BOT_TOKEN }}" \ | |
https://api.github.com/repos/wso2/apk/actions/workflows/49589306/enable | |