Clean GitHub Actions Cache #10504
This file contains hidden or 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 GitHub Actions Cache | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Schedule every hour | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| workflow_call: | |
| secrets: | |
| ACCESS_TOKEN: | |
| required: true | |
| jobs: | |
| clean-cache: | |
| if: contains(github.repository, 'php-proxy-hunter') | |
| runs-on: windows-latest | |
| env: | |
| PIP_CACHE_DIR: '${{ github.workspace }}/project/tmp/pip' | |
| NUITKA_CACHE_DIR: '${{ github.workspace }}/project/tmp/nuitka-cache' | |
| NODE_OPTIONS: '--max_old_space_size=4096' #8192 4096 --expose-gc | |
| YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
| ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
| GH_TOKEN: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
| YARN_CHECKSUM_BEHAVIOR: update | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| repository: 'dimaslanjaka/php-proxy-hunter' | |
| ref: master | |
| token: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
| lfs: true | |
| # - name: Update Submodules | |
| # run: | | |
| # echo "init submodules" | |
| # git submodule init | |
| # git submodule foreach "git submodule init" | |
| # echo "sync submodules" | |
| # git submodule sync | |
| # git submodule foreach "git submodule sync" | |
| # echo "update submodules" | |
| # npm install -g rimraf binary-collections@https://raw.githubusercontent.com/dimaslanjaka/bin/master/releases/bin.tgz | |
| # npx rimraf .git/modules | |
| # npx submodule-install | |
| # git lfs track "*.rar" | |
| # shell: bash | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20.x | |
| cache: 'yarn' | |
| cache-dependency-path: 'package.json' | |
| - name: Get pip cache dir | |
| id: pip-cache | |
| run: echo "pip_cache_dir=$(pip cache dir)" >> $GITHUB_ENV | |
| - name: Setup Cache | |
| id: cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/.cache/pip | |
| ./dist/ | |
| ./tmp/ | |
| src/*.sqlite* | |
| src/*.mmdb | |
| node_modules/ | |
| .yarn/caches/ | |
| .yarn/*.gz | |
| ./venv/ | |
| ${{ env.pip_cache_dir }} | |
| ${{ env.NUITKA_CACHE_DIR }} | |
| *.lock | |
| *.txt | |
| package-lock.json | |
| assets/proxies/ | |
| vendor/ | |
| ${{ env.USERPROFILE }}\AppData\Local\Nuitka\Nuitka\Cache | |
| $HOME/AppData/Local/Nuitka/Nuitka/Cache | |
| config/ | |
| .cache/ | |
| working.json | |
| key: ${{ runner.os }}-python-${{ hashFiles('.husky/hash.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-python-${{ hashFiles('.husky/hash.txt') }} | |
| ${{ runner.os }}-python- | |
| ${{ runner.os }}-nuitka- | |
| ${{ runner.os }}-php- | |
| ${{ runner.os }}- | |
| - name: Install Dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| corepack enable | |
| yarn install | |
| - name: Initialize Github Actions | |
| id: php-github-actions-init | |
| env: | |
| GITHUB_OUTPUT: $GITHUB_OUTPUT | |
| run: | | |
| node setup.js | |
| - name: Clean github actions cache | |
| env: | |
| GH_TOKEN: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }} | |
| shell: cmd | |
| run: | | |
| call "${{ github.workspace }}/bin/clear-github-actions-cache.cmd" |