Cleanup #196
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: Cleanup | |
| on: | |
| schedule: | |
| # run every Saturday | |
| - cron: "0 12 * * 6" | |
| permissions: | |
| contents: read | |
| jobs: | |
| clean: | |
| name: Clean caches | |
| timeout-minutes: 5 | |
| continue-on-error: false | |
| runs-on: ubuntu-22.04 | |
| env: | |
| GOFLAGS: -v -mod=readonly | |
| steps: | |
| - name: Configure git for private modules | |
| env: | |
| ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }} | |
| run: echo "machine github.com login percona-robot password ${{ secrets.ROBOT_TOKEN }}" > $HOME/.netrc | |
| - name: Set up Go | |
| env: | |
| # to avoid error due to `go version` accepting -v flag with an argument since 1.15 | |
| GOFLAGS: "" | |
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | |
| with: | |
| go-version-file: ${{ github.workspace }}/go.mod | |
| - name: Check out code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| lfs: true | |
| - name: Enable Go modules cache | |
| uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }} | |
| restore-keys: ${{ runner.os }}-go-modules- | |
| - name: Enable Go build cache | |
| uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| with: | |
| path: ~/.cache/go-build | |
| key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go-build-${{ github.ref }}- | |
| ${{ runner.os }}-go-build- | |
| - name: Clean Go modules cache | |
| run: go clean -modcache | |
| - name: Clean Go build cache | |
| run: go clean -cache |