tailscale / gitops-acl-action

GitOps for your Tailscale ACLs
81 stars 24 forks source link

Restore cache failed: Dependencies file is not found #36

Open jason-riddle opened 6 months ago

jason-riddle commented 6 months ago

The Problem

Given the following Github Actions YAML Workflow

---
name: Sync - ACLs

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - '*'

jobs:
  sync-acls:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Test ACLs
        uses: tailscale/gitops-acl-action@v1
        with:
          api-key: ${{ secrets.TS_API_KEY }}
          tailnet: ${{ secrets.TS_TAILNET }}
          policy-file: "policy.hujson"
          action: test

I'm getting the following warning message during the Github Actions run output

Run tailscale/gitops-acl-action@v1
Run actions/setup-go@v4.0.0
Setup go version spec 1.21.6
[...]
Warning: Restore cache failed: Dependencies file is not found in /home/runner/work/tailscale-acls/tailscale-acls. Supported file pattern: go.sum

The Explanation

It looks like because there isn't a go.sum file, the default behavior for actions/setup-go@v4.0.0 is to use caching.

From https://github.com/actions/setup-go/tree/v4.0.0?tab=readme-ov-file#v4

The V4 edition of the action offers:

  • Enabled caching by default

The action will try to enable caching unless the cache input is explicitly set to false.

The Fix

As discussed in https://github.com/actions/setup-go/issues/427#issuecomment-1731969319, the following change can be made to actions/setup-go@v4.0.0 so that the warning message goes away

- name: Setup go
  uses: actions/setup-go@v4.0.0
  with:
    cache: false
esolitos commented 4 months ago

I'd say this was fixed by https://github.com/tailscale/gitops-acl-action/pull/37

irbekrm commented 3 months ago

As @esolitos noted, the issue should be fixed by #37

We've just cut a v1.3.0 release that has this change https://github.com/tailscale/gitops-acl-action/releases/tag/v1.3.0 Let us know if you see any further issues.