diff --git a/.github/workflows/caches.yml b/.github/workflows/caches.yml index 5f011e2c..df3d2dd4 100644 --- a/.github/workflows/caches.yml +++ b/.github/workflows/caches.yml @@ -1,41 +1,50 @@ -name: cache invalidation +name: Cache invalidation on: workflow_dispatch: schedule: - - cron: '0 7 1 * *' # https://crontab.guru/#0_7_1_%2A_%2A, CET==UTC+1 + - cron: 0 7 1 * * jobs: - drop: + delete: + name: Deleting runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout the repository + uses: actions/checkout@v3 with: { fetch-depth: 0 } - - run: | - gh extension install actions/gh-actions-cache - keys=$(gh actions-cache list -R ${{ github.repository }} | cut -f1) + - name: Install a GitHub CLI cache extension + run: gh extension install actions/gh-actions-cache + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Cleanup caches + run: | + keys=$(gh actions-cache list -R '${{ github.repository }}' | cut -f1) + if [ -z "${keys}" ]; then echo 'Nothing to do' && exit 0; fi - set +e - echo "Deleting caches..." + echo Deleting caches... for key in ${keys}; do - gh actions-cache delete ${key} -R ${{ github.repository }} --confirm + gh actions-cache delete "${key}" -R '${{ github.repository }}' --confirm || true done - echo "Done" + echo Done env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} notify: - needs: [ drop ] + name: Notifying + needs: [ delete ] runs-on: ubuntu-latest + if: failure() || success() steps: - - uses: rtCamp/action-slack-notify@v2 + - name: Send Slack notification + uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} SLACK_ICON: https://github.com/github.png?size=64 - SLACK_TITLE: '${{ github.repository }}: ${{ github.workflow }}' + SLACK_TITLE: '🧹 ${{ github.repository }}: ${{ github.workflow }}' SLACK_USERNAME: GitHub Actions SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f6f3e2f..64ab357a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,10 +33,10 @@ jobs: - uses: actions/cache@v3 with: path: ./node_modules - key: modules-${{ hashFiles('package-lock.json') }} - id: cache + key: core-${{ hashFiles('package-lock.json') }} + id: core - run: npm ci --ignore-scripts --include=dev - if: steps.cache.outputs.cache-hit != 'true' + if: steps.core.outputs.cache-hit != 'true' env: { FONTAWESOME_TOKEN: '${{ secrets.FONTAWESOME_TOKEN }}' } - run: npm run build