|
@@ -31,6 +31,51 @@ Fix issues with AI-generated pull requests, powered by ChatGPT
|
|
|
|
|
|
## 源码分析
|
|
|
|
|
|
+采用 github action 方式自动化pull request。 触发条件:
|
|
|
+
|
|
|
+```
|
|
|
+on:
|
|
|
+ issues:
|
|
|
+ types: [labeled]
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+标签为 AutoPR,则继续执行,否则exit:
|
|
|
+
|
|
|
+```
|
|
|
+ curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" \
|
|
|
+ "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}" | jq -r '.message'
|
|
|
+```
|
|
|
+
|
|
|
+继续执行,采用的是 docker 容器方式:
|
|
|
+
|
|
|
+```
|
|
|
+docker://ghcr.io/irgolic/autopr:latest
|
|
|
+```
|
|
|
+
|
|
|
+执行 :
|
|
|
+
|
|
|
+```
|
|
|
+python -m autopr.gh_actions_entrypoint
|
|
|
+```
|
|
|
+
|
|
|
+执行 main方法,先切换到 autopr/issue-# 分支, commit,然后 push,发起pull request
|
|
|
+
|
|
|
+```
|
|
|
+ main(
|
|
|
+ repo_path=repo_path,
|
|
|
+ event=event,
|
|
|
+ commit_service=commit_service,
|
|
|
+ publish_service=publish_service,
|
|
|
+ settings=settings,
|
|
|
+ )
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+```
|
|
|
|
|
|
|
|
|
## 💎 Examples
|