github.com/grafana/synthetic-monitoring-agent@v0.64.2/.github/actions/go-cache-restore/action.yml (about)

     1  name: 'Restore Go cache'
     2  description: 'Restore Go cache from previous runs'
     3  outputs:
     4    key:
     5      description: "The key to use when restoring the cache"
     6      value: ${{ steps.restore-go-cache.outputs.cache-primary-key }}
     7    path:
     8      description: "The path or paths added to the cache"
     9      value: ${{ steps.compute-cache-info.outputs.path }}
    10  runs:
    11    using: "composite"
    12    steps:
    13      - name: Compute cache info
    14        id: compute-cache-info
    15        shell: bash
    16        env:
    17          GITHUB_BASE_REF: ${{ github.base_ref }}
    18        run: |
    19          cat <<EOT >> "$GITHUB_OUTPUT"
    20          key=$(./scripts/get-go-cache-key "${GITHUB_BASE_REF}")
    21          base_key=$(./scripts/get-go-cache-key "${GITHUB_BASE_REF}" | sed -E -e 's,-[^-]+$,-,')
    22          path<<EOS
    23          $(go env GOCACHE)
    24          $(go env GOMODCACHE)
    25          $(golangci-lint cache status | grep ^Dir: | cut -d' ' -f2)
    26          EOS
    27          EOT
    28  
    29      - name: Restore Go cache
    30        id: restore-go-cache
    31        uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
    32        with:
    33          key: go-cache-${{ steps.compute-cache-info.outputs.key }}
    34          path: ${{ steps.compute-cache-info.outputs.path }}
    35          restore-keys: |
    36            go-cache-${{ steps.compute-cache-info.outputs.base_key }}