Closed yuri-val closed 2 weeks ago
It seems like a good way to steal the secrets.GITHUB_TOKEN to your classmates accounts, I like it, I'm going to adopt it, thanks
It's alive! https://github.com/hqnicolas/auto-pr-description-g4f-action/releases
I was going to comment that you code as fast as a room full of Chinese hackers but then I saw your repertoire from 11 days ago
https://github.com/yuri-val/auto-pr-description-action
That's a thing G4F solved....
Yes, you are right. It's just a "free" rewrote to Python version of main action
@yuri-val
if I dont provide Rulles....
Generated description (attempt 1):
This pull request is empty. There are no changes to describe.
Updating PR description...
Error updating PR description: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/pulls/pulls#update-a-pull-request", "status": "403"}
Action failed: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/pulls/pulls#update-a-pull-request", "status": "403"}
Traceback (most recent call last):
File "/app/main.py", line 169, in <module>
main()
~~~~^^
File "/app/main.py", line 86, in main
update_pr_description(github_token, context, pr_number, generated_description)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/main.py", line 160, in update_pr_description
pull_request.edit(body=new_description)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/github/PullRequest.py", line 559, in edit
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/github/Requester.py", line 586, in requestJsonAndCheck
return self.__check(*self.requestJson(verb, url, parameters, headers, input, self.__customConnection(url)))
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/github/Requester.py", line 744, in __check
raise self.createException(status, responseHeaders, data)
github.GithubException.GithubException: [40](https://github.com/hqnicolas/Ollama-Pilot-CasaOs/actions/runs/11727371552/job/32668320091?pr=1#step:4:41)3 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/pulls/pulls#update-a-pull-request", "status": "403"}
@yuri-val after added rules.... https://github.com/hqnicolas/Ollama-Pilot-CasaOs/actions/runs/11727966913/job/32670320667?pr=4
Sending request to GPT-4 with temperature 0.7
Received response from o1-mini. Length: 65 characters
Generated description (attempt 1):
This pull request is empty. There are no changes to describe. ๐ค
Creating comment with original description...
Error updating PR description: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment", "status": "403"}
Action failed: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment", "status": "403"}
Traceback (most recent call last):
File "/app/main.py", line 169, in <module>
main()
~~~~^^
File "/app/main.py", line 86, in main
update_pr_description(github_token, context, pr_number, generated_description)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/main.py", line 156, in update_pr_description
pull_request.create_issue_comment(f'**Original description**:\n\n{current_description}')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/github/PullRequest.py", line 477, in create_issue_comment
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.issue_url}/comments", input=post_parameters)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/github/Requester.py", line 586, in requestJsonAndCheck
return self.__check(*self.requestJson(verb, url, parameters, headers, input, self.__customConnection(url)))
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/github/Requester.py", line 856, in requestJson
return self.__requestEncode(cnx, verb, url, parameters, headers, input, encode)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/github/Requester.py", line 977, in __requestEncode
status, responseHeaders, output = self.__requestRaw(cnx, verb, url, requestHeaders, encoded_input)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/github/Requester.py", line 1011, in __requestRaw
response = cnx.getresponse()
File "/usr/local/lib/python3.13/site-packages/github/Requester.py", line 202, in getresponse
r = verb(
url,
...<4 lines>...
allow_redirects=False,
)
File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 637, in post
return self.request("POST", url, data=data, json=json, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 667, in send
resp = conn.urlopen(
method=request.method,
...<9 lines>...
chunked=chunked,
)
File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 9[34](https://github.com/hqnicolas/Ollama-Pilot-CasaOs/actions/runs/11727661900/job/32669291658#step:4:35), in urlopen
retries = retries.increment(method, url, response=response, _pool=self)
File "/usr/local/lib/python3.13/site-packages/github/GithubRetry.py", line 187, in increment
raise Requester.createException(response.status, response.headers, content) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
github.GithubException.GithubException: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment", "status": "[40](https://github.com/hqnicolas/Ollama-Pilot-CasaOs/actions/runs/11727661900/job/32669291658#step:4:41)3"}
You should also check repo Action permissions Repo -> Settings -> Actions -> General
@hqnicolas
Your workflow looks mostly correct, but the permission issue (403: Resource not accessible by integration) could still arise if the default GitHub token lacks appropriate scope. Below are a few recommendations to troubleshoot and resolve the error:
The permissions youโve set (pull-requests: write, issues: write) should generally be sufficient, but sometimes GitHubโs permission model requires more than expected. I recommend explicitly adding permissions for workflow runs and checking if it helps:
permissions:
contents: read
pull-requests: write
issues: write
workflows: write
If youโre running this workflow in a forked repository or GitHub Actions environments where the default GITHUB_TOKEN might have limited permissions, using a PAT might be necessary. To generate a PAT: โข Go to your GitHub settings. โข Under โDeveloper Settings,โ generate a new PAT with repo and workflow scopes. โข Store this token in your repository secrets, for example, under PAT_TOKEN.
Update your workflow to use the PAT:
with:
github_token: ${{ secrets.PAT_TOKEN }}
GitHubโs 403 errors can be tricky. Here are some additional steps for debugging: โข Ensure that the workflow is triggered by an event that grants the correct permissions. In particular, PR events from forked repositories often lack write permissions for security reasons. โข You can add a debugging step in your workflow to output information about the GitHub tokenโs permissions:
- name: Debug Token Permissions
run: |
echo "Checking token permissions..."
curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}
This will allow you to understand whether the token has the correct permissions or is restricted.
Summary of Changes
1. Add explicit workflows: write permission to the job.
2. Try using a PAT instead of the default GITHUB_TOKEN if the repository is forked.
3. Debug the tokenโs permissions using a debugging step.
Hereโs an updated version of your workflow incorporating these suggestions:
name: Auto generate PR Description [C4F]
on:
pull_request:
types: [opened, synchronize]
jobs:
generate-pr-description:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
workflows: write
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Debug Token Permissions
run: |
echo "Checking token permissions..."
curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}
- name: Auto-generate PR Description
uses: hqnicolas/auto-pr-description-g4f-action@v1.2.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
model: 'o1-mini'
Let me know if this helps solve the issue, or if you need more support in adjusting the permissions.
workflows: write
it brokes the app...........
Bumping this pull request because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.
You need to do things like the copilot does to work properly. https://github.com/xtekky/gpt4free/blob/main/.github%2Fworkflows%2Fcopilot.yml
@hlohaus what do you mean?
Hey, you need to run it on unit test workflow. And this event has the correct GitHub token.
@hlohaus I don't see the point of doing this for several reasons:
As a result:
action
specifically for your projectaction
, they will have to adapt their workflow
to this action
I will merge your PR, but you will see. ๐ โโ๏ธ You have not enoght permission for writing to the Pull Request ๐ โโ๏ธ
https://github.com/xtekky/gpt4free/actions/runs/11881376591/job/33105637066
RuntimeError: Failed to fetch branches. Exit code: 32768
https://github.com/xtekky/gpt4free/actions/runs/11881376591/job/33105637066
RuntimeError: Failed to fetch branches. Exit code: 32768
Ok, I'll check it tomorrow. "On my machine it works fine:)" ยฉ๏ธ
๐ Feature Addition: Auto-generate Pull Request Descriptions! ๐
This PR introduces a new GitHub Actions workflow that automatically generates descriptions for pull requests when they are opened or synchronized.
Key Changes:
.github/workflows/auto-pr-description.yml
yuri-val/auto-pr-description-g4f-action
to create informative PR descriptions automatically.Benefits:
Let's streamline our workflow and improve collaboration! ๐