Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stale workflow fails to override cache. #1131

Open
1 of 5 tasks
mshima opened this issue Jan 29, 2024 · 8 comments · May be fixed by #1183
Open
1 of 5 tasks

Stale workflow fails to override cache. #1131

mshima opened this issue Jan 29, 2024 · 8 comments · May be fixed by #1183
Assignees
Labels
bug Something isn't working

Comments

@mshima
Copy link

mshima commented Jan 29, 2024

Description:
We have a stale workflow: https://github.com/jhipster/generator-jhipster/blob/main/.github/workflows/stale.yml

At first run it successfully generates a cache entry.

After that, the cache is never updated and is reused, so cached entries are never analyzed again.
See builds 599-605 at https://github.com/jhipster/generator-jhipster/actions/workflows/stale.yml

See 2 consecutive days have same cached issue numbers:
https://github.com/jhipster/generator-jhipster/actions/runs/7689412024/job/20951825772
https://github.com/jhipster/generator-jhipster/actions/runs/7682085625/job/20936000418

The error reported is:
Warning: Error delete _state: [403] Resource not accessible by integration

Are we missing a configuration? A permission maybe? There is no info in the docs.

Action version:
v9

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
Links above.

Expected behavior:
A new cache should be written at every run.

Actual behavior:
New cache are not been overridden

@mshima mshima added bug Something isn't working needs triage labels Jan 29, 2024
@HarithaVattikuti
Copy link
Contributor

Hello @mshima
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

@csuermann
Copy link

Looks like issues already processed in previous runs never get closed due to the cache.

.github/workflows/stale.yaml:

name: 'Close stale issues'
on:
  workflow_dispatch:
  schedule:
    - cron: '30 1 * * *'
permissions:
  issues: write

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
          days-before-stale: 30
          days-before-close: 5
Run actions/stale@v9
Cache Size: ~0 MB (307 B)
/usr/bin/tar -xf /home/runner/work/_temp/f4844f75-67b0-4546-8244-42b90d2f9d54/cache.tzst -P -C /home/runner/work/xxx --use-compress-program unzstd
Cache restored successfully
state: restored with info about 12 issue(s)
Starting the stale action process...
Processing the batch of issues  #1  containing  11  issues...
[#239] Issue #239
[#238] Issue #238
[#237] Issue #237
[#235] Issue #235
[#234] Issue #234
[#231]            issue skipped due being processed during the previous run
[#229]            issue skipped due being processed during the previous run
[#227]            issue skipped due being processed during the previous run
[#222]            issue skipped due being processed during the previous run
[#221]            issue skipped due being processed during the previous run
[#219]            issue skipped due being processed during the previous run
Batch  #1  processed.
No more issues found to process. Exiting...
Statistics:
Processed issues: 5
Fetched items: 11
Operations performed: 2
Github API rate used: 2
Github API rate remaining: 997; reset at: Wed Feb 07 2024 02:59:48 GMT+0000 (Coordinated Universal Time)
state: persisting info about 0 issue(s)
Warning: Error delete _state: [403] Resource not accessible by integration
the state will be removed
Received 307 of 307 (100.0%), 0.0 MBs/sec

@mshima
Copy link
Author

mshima commented Feb 7, 2024

As workaround:

  • manually delete the cache.
  • make sure every run processes every issue so cache is not created.

@anomiex
Copy link

anomiex commented Feb 22, 2024

I think the docs are missing that the actions: write permission is needed.

I saw the "Error delete _state: [403] Resource not accessible by integration" error here in a test repo while trying to reproduce a different issue, and based on the docs for the API used I added that permission and the error went away.

@suyashgaonkar
Copy link

Hi @mshima , we did investigation with provided information for the issue. Tried to reproduce the issue with actions/stale v8 and v9 both, and everything seems to be working fine on our end. We did not get the mentioned error Warning: Error delete _state: [403] Resource not accessible by integration.
For cache to get generated and getting restored the number of operations happening with Github API should exceed the value set in the operations-per-run (deault:30). If not so then we get "The saved state was not found, the process starts from the first issue." in the logs.
you can refer the following links :
https://github.com/actions/stale?tab=readme-ov-file
https://github.com/actions/stale?tab=readme-ov-file#operations-per-run
Please let us know if you still need any assistance on this as we see recent runs for the mentioned workflow has no issues in the provided repo too. You can check attached the screenshots for more details.

Screenshot 2024-10-01 at 2 51 09 PM Screenshot 2024-10-01 at 3 28 55 PM

@suyashgaonkar
Copy link

Hi @mshima , We are awaiting for your response on the issue. Please let us know if we can close this issue if there are no further queries.

@mshima
Copy link
Author

mshima commented Oct 16, 2024

@suyashgaonkar thanks for the response.
Screenshots from #1131 does not demonstrates the issue since it do not show that the cache is correctly overridden in second run.

We've not had more problems since stale only processes at most 1-2 issues per day in our use case. At adoption we had more than 100 stale issues pending.

@ericLemanissier ericLemanissier linked a pull request Oct 16, 2024 that will close this issue
2 tasks
@ericLemanissier
Copy link

@mshima you probably want to try my proposition from #1183.
For this, you can replace uses: actions/stale@...with uses: actions/stale@ericLemanissier/patch-2 and remove actions: write from https://github.com/jhipster/generator-jhipster/blob/main/.github/workflows/stale.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants