Runs that are triggered by merging pull requests, like
on:
pull_request:
types: [closed]
Have no access to cache even though GITHUB_REF is defined.
The following errors are returned when trying to read or write:
[warning]getCacheEntry failed: No scopes with read permission were found on the request.
...
[warning]reserveCache failed: No scopes with write permission were found on the request.
I created a very minimal reproduction repo and a trial run that you can easily check here.
GITHUB_REF in the failing case is master which is the main branch. In case of closing the pull request without merging, its in the format refs/pull/:prNumber/merge as mentioned in the documentation.Having the exact same problem.
As a workaround I've considered to write simple action that saves cache to s3 bucket until this issue will fixed.
@metalsong Here's an example if you plan to go the s3 route - https://gist.github.com/scottjacobsen/ef7ccdf0ef48080a63e2fd4076d4e83f
I tried this (failed) workaround to open the workflow for all pull_request events, then check the event type within the jobs. An Action is triggered on pull request creation (and the jobs successfully skip), but another action is not triggered for its close/merge.
name: Workflow Name
on:
pull_request:
branches:
- master
jobs:
job-name:
if: github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
Update: Ah, it's expected to not run on closed events. 馃う
Most helpful comment
@metalsong Here's an example if you plan to go the s3 route - https://gist.github.com/scottjacobsen/ef7ccdf0ef48080a63e2fd4076d4e83f