BobAnkh / auto-generate-changelog

A Github Action to generate CHANGELOG automatically according to conventional commits. Feel free to contribute!
Apache License 2.0
81 stars 23 forks source link

[question] Fetching .RateLimitExceededException: 403 instead of a changelog generation #88

Closed sergeykrupenich closed 2 years ago

sergeykrupenich commented 2 years ago

I try to use the sample below.

on:
  push:
    branches:
      - develop
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - uses: BobAnkh/auto-generate-changelog@master
      with:
        REPO_NAME: 'my_name/my_repo'
        ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        PATH: 'CHANGELOG.md'
        COMMIT_MESSAGE: 'docs(CHANGELOG): update release notes'
        TYPE: 'feat:Feature,fix:Bug Fixes,docs:Documentation,refactor:Refactor,perf:Performance Improvements'

But fetch an error:

  File "/main.py", line 519, in <module>
    main()
  File "/main.py", line 506, in main
    changelog.get_data()
  File "/main.py", line 200, in get_data
    if pulls.totalCount == 0:
  File "/usr/local/lib/python3.9/site-packages/github/PaginatedList.py", line 149, in totalCount
    headers, data = self.__requester.requestJsonAndCheck(
  File "/usr/local/lib/python3.9/site-packages/github/Requester.py", line 353, in requestJsonAndCheck
    return self.__check(
  File "/usr/local/lib/python3.9/site-packages/github/Requester.py", line 378, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.RateLimitExceededException: 403 {"message": "API rate limit exceeded for installation ID 15490637.", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}

Commits progress:  14%|█▎        | 953/7015 [03:20<21:13,  4.76it/s]

So what is wrong?

boring-cyborg[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the issue template!

BobAnkh commented 2 years ago

@sergeykrupenich Well, this is a rate limit of Github. Because my GA has to fetch the detail information of every commit, there is a rate limit for the normal built-in GITHUB_TOKEN while you are having thousands of commits, so it exceeded the limit.

See this page for the rate limit rules of Github. Generally, 1000 requests/hour for GITHUB_TOKEN. So up to 7000 commits apparently exceeds this limit. Maybe you can create a personal access token yourself and use it instead or cherry-pick some of the commits to a new branch as a subset and generate a changelog from that.

I haven't got any better ideas of how to avoid this while one are having many commits. If you come up with a better idea, please tell me.

sgbaird commented 2 years ago

I'm seeing this for many fewer commits:

Commits progress:   0%|          | 0/416 [00:00<?, ?it/s]
Commits progress:   0%|          | 1/416 [00:00<03:44,  1.85it/s]
Commits progress:   0%|          | 2/416 [00:00<02:35,  2.67it/s]
Commits progress:   1%|          | 3/416 [00:01<02:13,  3.09it/s]
Commits progress:   1%|          | 4/416 [00:01<03:29,  1.96it/s]
Commits progress:   1%|          | 5/416 [00:02<03:51,  1.78it/s]
Commits progress:   1%|▏         | 6/416 [00:03<04:07,  1.66it/s]
Commits progress:   2%|▏         | 7/416 [00:03<04:28,  1.52it/s]
Commits progress:   2%|▏         | 8/416 [00:04<04:42,  1.44it/s]
Commits progress:   2%|▏         | 9/416 [00:05<04:41,  1.45it/s]
Commits progress:   2%|▏         | 10/416 [00:06<04:36,  1.47it/s]
Commits progress:   3%|▎         | 11/416 [00:06<04:37,  1.46it/s]
Commits progress:   3%|▎         | 12/416 [00:07<04:38,  1.45it/s]
Commits progress:   3%|▎         | 13/416 [00:08<04:35,  1.46it/s]
Commits progress:   3%|▎         | 14/416 [00:08<04:36,  1.45it/s]
Commits progress:   4%|▎         | 15/416 [00:09<04:34,  1.46it/s]
Commits progress:   4%|▍         | 16/416 [00:10<04:25,  1.50it/s]
Commits progress:   4%|▍         | 17/416 [00:10<04:29,  1.48it/s]
Commits progress:   4%|▍         | 18/416 [00:11<04:33,  1.45it/s]
Commits progress:   5%|▍         | 19/416 [00:12<04:34,  1.44it/s]
Commits progress:   5%|▍         | 20/416 [00:12<04:25,  1.49it/s]
Commits progress:   5%|▌         | 21/416 [00:13<03:37,  1.[81](https://github.com/sparks-baird/xtal2png/runs/6973120714?check_suite_focus=true#step:4:82)it/s]
Commits progress:   5%|▌         | 22/416 [00:13<03:07,  2.11it/s]
Commits progress:   6%|▌         | 23/416 [00:13<02:38,  2.48it/s]
Commits progress:   6%|▌         | 24/416 [00:14<03:08,  2.08it/s]
Commits progress:   6%|▌         | 25/416 [00:14<03:25,  1.90it/s]
Commits progress:   6%|▋         | 26/416 [00:15<02:52,  2.27it/s]
Commits progress:   6%|▋         | 27/416 [00:16<03:53,  1.66it/s]
Commits progress:   7%|▋         | 28/416 [00:16<04:03,  1.59it/s]
Commits progress:   7%|▋         | 29/416 [00:17<04:10,  1.55it/s]
Commits progress:   7%|▋         | 30/416 [00:18<04:13,  1.52it/s]
Commits progress:   7%|▋         | 31/416 [00:18<04:12,  1.53it/s]
Commits progress:   8%|▊         | 32/416 [00:19<04:14,  1.51it/s]
Commits progress:   8%|▊         | 33/416 [00:20<04:37,  1.38it/s]
Commits progress:   8%|▊         | 34/416 [00:21<04:36,  1.38it/s]
Commits progress:   8%|▊         | 35/416 [00:21<04:37,  1.37it/s]
Commits progress:   9%|▊         | 36/416 [00:22<04:23,  1.44it/s]
Commits progress:   9%|▉         | 37/416 [00:23<04:21,  1.45it/s]
Commits progress:   9%|▉         | 38/416 [00:23<04:18,  1.46it/s]
Commits progress:   9%|▉         | 39/416 [00:24<04:18,  1.46it/s]
Commits progress:  10%|▉         | 40/416 [00:25<04:10,  1.50it/s]
Commits progress:  10%|▉         | 41/416 [00:25<04:16,  1.46it/s]
Commits progress:  10%|█         | 42/416 [00:26<03:26,  1.81it/s]
Commits progress:  10%|█         | 43/416 [00:26<02:50,  2.19it/s]
Commits progress:  11%|█         | 44/416 [00:26<02:25,  2.55it/s]
Commits progress:  11%|█         | 45/416 [00:26<02:14,  2.77it/s]
Commits progress:  11%|█         | 46/416 [00:27<03:07,  1.97it/s]
Commits progress:  11%|█▏        | 47/416 [00:28<03:23,  1.81it/s]
Commits progress:  12%|█▏        | 48/416 [00:29<03:33,  1.72it/s]
Commits progress:  12%|█▏        | 49/416 [00:29<03:36,  1.70it/s]
Commits progress:  12%|█▏        | 50/416 [00:30<03:54,  1.56it/s]
Commits progress:  12%|█▏        | 51/416 [00:31<03:56,  1.54it/s]
Commits progress:  12%|█▎        | 52/416 [00:32<04:31,  1.34it/s]
Commits progress:  13%|█▎        | 53/416 [00:32<04:24,  1.37it/s]
Commits progress:  13%|█▎        | 54/416 [00:33<04:36,  1.31it/s]
Commits progress:  13%|█▎        | 55/416 [00:34<04:29,  1.34it/s]
Commits progress:  13%|█▎        | 56/416 [00:35<04:25,  1.35it/s]
Commits progress:  14%|█▎        | 57/416 [00:36<04:50,  1.24it/s]
Commits progress:  14%|█▍        | 58/416 [00:36<04:40,  1.28it/s]
Commits progress:  14%|█▍        | 59/416 [00:37<04:28,  1.33it/s]
Commits progress:  14%|█▍        | 60/416 [00:39<06:01,  1.02s/it]
Commits progress:  15%|█▍        | 61/416 [00:39<05:25,  1.09it/s]
Commits progress:  15%|█▍        | 62/416 [00:40<04:59,  1.18it/s]
Commits progress:  15%|█▌        | 63/416 [00:41<04:40,  1.26it/s]
Commits progress:  15%|█▌        | 64/416 [00:41<04:26,  1.32it/s]
Commits progress:  16%|█▌        | 65/416 [00:42<04:15,  1.37it/s]
Commits progress:  16%|█▌        | 66/416 [00:43<04:14,  1.38it/s]
Commits progress:  16%|█▌        | 67/416 [00:43<04:12,  1.38it/s]
Commits progress:  16%|█▋        | 68/416 [00:44<04:16,  1.36it/s]
Commits progress:  17%|█▋        | 69/416 [00:45<04:07,  1.40it/s]
Commits progress:  17%|█▋        | 70/416 [00:46<04:09,  1.39it/s]
Commits progress:  17%|█▋        | 71/416 [00:46<04:05,  1.40it/s]
Commits progress:  17%|█▋        | 72/416 [00:47<04:07,  1.39it/s]
Commits progress:  18%|█▊        | 73/416 [00:48<04:03,  1.41it/s]
Commits progress:  18%|█▊        | 74/416 [00:48<03:58,  1.43it/s]
Commits progress:  18%|█▊        | 75/416 [00:49<03:54,  1.45it/s]
Commits progress:  18%|█▊        | 76/416 [00:50<03:53,  1.45it/s]
Commits progress:  19%|█▊        | 77/416 [00:50<03:09,  1.79it/s]
Commits progress:  19%|█▉        | 78/416 [00:50<02:36,  2.15it/s]
Commits progress:  19%|█▉        | 79/416 [00:50<02:15,  2.49it/s]
Commits progress:  19%|█▉        | 80/416 [00:51<02:00,  2.80it/s]
Commits progress:  19%|█▉        | 81/416 [00:51<02:28,  2.26it/s]
Commits progress:  20%|█▉        | [82](https://github.com/sparks-baird/xtal2png/runs/6973120714?check_suite_focus=true#step:4:83)/416 [00:52<02:49,  1.98it/s]
Commits progress:  20%|█▉        | [83](https://github.com/sparks-baird/xtal2png/runs/6973120714?check_suite_focus=true#step:4:84)/416 [00:53<03:02,  1.82it/s]
Commits progress:  20%|██        | [84](https://github.com/sparks-baird/xtal2png/runs/6973120714?check_suite_focus=true#step:4:85)/416 [00:53<03:13,  1.71it/s]
Commits progress:  20%|██        | [85](https://github.com/sparks-baird/xtal2png/runs/6973120714?check_suite_focus=true#step:4:86)/416 [00:54<03:18,  1.67it/s]Traceback (most recent call last):
  File "/main.py", line 519, in <module>
    main()
  File "/main.py", line 506, in main
    changelog.get_data()
  File "/main.py", line 200, in get_data
    if pulls.totalCount == 0:
  File "/usr/local/lib/python3.9/site-packages/github/PaginatedList.py", line 149, in totalCount
    headers, data = self.__requester.requestJsonAndCheck(
  File "/usr/local/lib/python3.9/site-packages/github/Requester.py", line 353, in requestJsonAndCheck
    return self.__check(
  File "/usr/local/lib/python3.9/site-packages/github/Requester.py", line 378, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.RateLimitExceededException: 403 {"message": "API rate limit exceeded for installation ID 20[134](https://github.com/sparks-baird/xtal2png/runs/6973120714?check_suite_focus=true#step:4:135)666.", "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}
Commits progress:  20%|██        | 85/416 [00:54<03:32,  1.56it/s]
sgbaird commented 2 years ago

Using a PAT seemed to fix it https://github.com/sparks-baird/xtal2png/runs/7005162519?check_suite_focus=true (assuming that it wouldn't have run OK if I had kept it as secret.GITHUB_TOKEN). Not sure what the minimum required permissiveness is for the PAT. Any comment there? @BobAnkh

BobAnkh commented 2 years ago

Using a PAT seemed to fix it sparks-baird/xtal2png/runs/7005162519?check_suite_focus=true (assuming that it wouldn't have run OK if I had kept it as secret.GITHUB_TOKEN). Not sure what the minimum required permissiveness is for the PAT. Any comment there? @BobAnkh

Only repo is needed for your PAT to work IMO.

BobAnkh commented 2 years ago

Also I'm trying to fix this problem with incremental changelog generate in next release.

BobAnkh commented 2 years ago

@sgbaird @sergeykrupenich

The problem should be partially alleviated in the new release v1.2.1 with incremental changelog generation implemented.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue.