Cache: Allow using the cache for other than push and pull_request events

Created on 6 Nov 2019  路  21Comments  路  Source: actions/cache

When triggering my action with on: ['deployment']. It throws a warning about having no read permissions.

It doesn't happen with on: push.

##[debug]Resolved Keys:
##[debug]["Linux-yarn-...hash...","Linux-yarn-"]
##[debug]Cache Url: https://artifactcache.actions.githubusercontent.com/...hash.../
##[warning]No scopes with read permission were found on the request.
::set-output name=cache-hit,::false
documentation enhancement

Most helpful comment

The PR to allow all events to access cache is merged into master. It will be released as part of cache v2. We are targeting releasing v2 later this month.

You can ping to actions/cache@master to preview this feature.

All 21 comments

Saw a similar warning for one of my scheduled workflows. The same workflow ran fine 2 days ago (November 4). It failed yesterday too (November 5) so may be an issue on GitHub's end. Possibly the way permissions are granted to use the cache.

The cache is currently limited to push and pull_request events. We're looking into opening it up to more event types in the future.

I've filed an issue internally to get the docs updated with this information.

That makes sense. The runs that did work for me were triggered on push.

In addition to updating documentation, may I suggest improving the error message? To say that the action is not supported on the event that triggered it. Saves people having to dig through documentation for special cases.

Definitely would love to see this open up to other event types, particularly deployment and deployment_status. Our workflow is running smoke tests after a deployment happens. Since we can't use the caching action it takes a few minutes to download and install the necessary dependencies every time it's run.

Being able to cache this like we do with our push and pull_request events would save a ton of time.

Since this issue has all the context, I've changed it to focus on us opening the cache up for more events. Thanks for the feedback!

I'm tracking the confusing error message here: https://github.com/actions/cache/issues/64

repository_dispatch would be really nice to have covered as well :)

Hi @joshmgross yes please, open to other events likes on: ["deployment"]

We are using this workaround in this moment, but caching is not working...

https://github.community/t5/GitHub-Actions/GitHub-Actions-Manual-Trigger-Approvals/td-p/31504

Thanks!!

Would it be possible to revert to the previous behavior where this was only a warning instead of an error? All my usages of the cache are an optimization to make the job run faster. A cache miss (or in this case, skipping the cache lookup entirely due to unsupported event type) can be safely ignored and continue without the cache optimization.

@jasonkarns Yep, we're fixing that. Apologies for the break.

Fixing it here: https://github.com/actions/cache/pull/108

For a temporary workaround, you can use the previous version of the action with

uses: actions/[email protected]

or use an if statement like so:

    - name: My Cache
      if: github.event_name == 'push' || github.event_name == 'pull_request'
      uses: actions/cache@v1
      with:
        path: .github
        key: ${{ runner.os }}-github

I have a cron-based action that could benefit greatly from caching: auto-updates.yml

@lightswitch05 can you please explain the workflow? Thanks

Sure. PHP Version Audit self-updates twice a day using an auto-updates.yml action. The update function requires a lot of file downloads, and so was designed to make use of heavy caching. Along with the dependency install before the self-update can run, the action would benefit from cache support.

hope can support schedule

I would also like to use cached pip install for cron scheduled daily testing of Jupyter Notebooks : https://github.com/SimFin/simfin-tutorials/blob/master/.github/workflows/test.yml

I currently get this message in GitHub Actions: [warning]Event Validation Error: The event type schedule is not supported. Only push, pull_request events are supported at this time.

Thanks!

Would love to see caching support for deployment events. Any update on this issue and maybe a rough ETA? 馃檹 馃槃

Yes. Please have this support a repository_dispatch event. We're using this as a mechanism to trigger a build on master.

The cache support brings 80%+ improvement in our workflow, I'd like to see the schedule could be supported.馃檹

Any news on getting support for other events as well?

This would significantly speed up deployments decoupled from actual pushes by configuring workflows that listen to deployment events!

馃

Let us know if there is anything we can do to help!

I'm curious why only push and pull_request events are cached? Is there a system limitation, or just not implemented yet? I would be happy to take a stab at implementing caching for more event types if bandwidth is the problem.

I wrote about my desire for this feature on my blog: https://simonwillison.net/2020/Apr/14/datasette-clone/

I use scheduled actions to update SQLite databases: step 1 is to download the existing DB file, step 2 updates it, step 3 publishes it again if it has changed. I'd like to be able to use caching to skip that initial download!

The PR to allow all events to access cache is merged into master. It will be released as part of cache v2. We are targeting releasing v2 later this month.

You can ping to actions/cache@master to preview this feature.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wrightak picture wrightak  路  4Comments

gladhorn picture gladhorn  路  4Comments

hugovk picture hugovk  路  6Comments

sergeyzwezdin picture sergeyzwezdin  路  5Comments

Cerberus picture Cerberus  路  5Comments