athul / waka-readme

Wakatime Weekly Metrics on your Profile Readme.
https://github.com/athul
MIT License
1.56k stars 301 forks source link

"Resource not accessible by integration" error after running workflow #114

Closed zychen20 closed 1 year ago

zychen20 commented 1 year ago

I followed the guide and try to run the workflow manually. But it failed. All my settings are default, and the repository I used is my profile repository.

According to the logs, WakaTime API worked, and it seems that the problem is related to permission stuff. I checked the source code, and I guess the error happened at here. But I don't really know exactly what problem it is.

[2023-01-20 00:20:31] ln. 428 DEBUG    Initialize WakaReadme
[2023-01-20 00:20:31] ln. 163 DEBUG    Validating input variables
[2023-01-20 00:20:31] ln. 204 DEBUG    Input validation complete

[2023-01-20 00:20:31] ln. 397 DEBUG    Connecting to GitHub
[2023-01-20 00:20:31] ln. 402 DEBUG    Decoding readme contents

[2023-01-20 00:20:31] ln. 326 DEBUG    Pulling WakaTime stats from last 7 days
[2023-01-20 00:20:32] ln. 345 DEBUG    API response #1: 200 • OK
[2023-01-20 00:20:32] ln. 349 DEBUG    Fetched WakaTime statistics

[2023-01-20 00:20:32] ln. 287 DEBUG    Making contents
[2023-01-20 00:20:32] ln. 241 DEBUG    Generating graph for "JSON"
[2023-01-20 00:20:32] ln. 251 DEBUG    JSON graph generated
[2023-01-20 00:20:32] ln. 241 DEBUG    Generating graph for "Other"
[2023-01-20 00:20:32] ln. 251 DEBUG    Other graph generated
[2023-01-20 00:20:32] ln. 310 DEBUG    Contents were made

[2023-01-20 00:20:32] ln. 405 DEBUG    WakaReadme stats has changed
JSON         22 mins         ████████████▓░░░░░░░░░░░░   51.32 %
Other        13 mins         ███████▒░░░░░░░░░░░░░░░░░   29.42 %

[2023-01-20 00:20:32] ln. 442 CRITICAL 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents"}
dxnter commented 1 year ago

I just ran into this issue as well. You can fix this in the Settings of your repository by navigating to Code and automation → Actions → General → Workflow permissions and select and save the Read and write permissions option.

Related: PyGithub/PyGithub#2372

yozachar commented 1 year ago

Thanks for the tip @dxnter! @zychen20 please check https://github.com/zychen20/zychen20/settings/actions if it corresponds to:

image

zychen20 commented 1 year ago

Thanks for the tip @dxnter! @zychen20 please check https://github.com/zychen20/zychen20/settings/actions if it corresponds to:

image

It worked, thank you so much!