github-rest-api 0.47.2__tar.gz → 0.49.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- github_rest_api-0.49.0/.github/workflows/auto_merge_pull_request.yaml +81 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.github/workflows/claude-code-review.yml +25 -14
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/PKG-INFO +1 -1
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/__init__.py +8 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/github.py +546 -31
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/container/build_container_images.py +6 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/auto_merge_pull_request.py +3 -2
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/create_github_repo.py +73 -18
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/create_pull_request.py +10 -1
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/utils.py +3 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/utils.py +19 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/pyproject.toml +3 -2
- github_rest_api-0.49.0/tests/test_auto_merge_pull_request.py +16 -0
- github_rest_api-0.49.0/tests/test_create_github_repo.py +128 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/tests/test_create_pull_request.py +12 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/tests/test_github.py +615 -3
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/tests/test_utils.py +21 -1
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/uv.lock +1 -1
- github_rest_api-0.47.2/github_rest_api/scripts/github/workflows/auto_merge_pull_request.yaml +0 -30
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.devcontainer/devcontainer.json +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.github/workflows/claude.yml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.github/workflows/create_pr_to_main.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.github/workflows/lint.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.github/workflows/release.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.github/workflows/remove_branch.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.github/workflows/test.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/.gitignore +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/GEMINI.md +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/README.md +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/pr_content.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/__init__.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/cargo/__init__.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/cargo/benchmark.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/cargo/profiling.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/cargo/utils.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/container/__init__.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/container/config_container.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/container/update_version_containerfile.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/__init__.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/release_on_github.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/remove_branch.py +0 -0
- {github_rest_api-0.47.2/.github → github_rest_api-0.49.0/github_rest_api/scripts/github}/workflows/auto_merge_pull_request.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/workflows/create_pr_dev_to_main.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/workflows/create_pr_to_dev.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/workflows/create_pr_to_main.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/workflows/python/lint.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/workflows/python/test.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/github_rest_api/scripts/github/workflows/remove_branch.yaml +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/memory/MEMORY.md +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/memory/feedback_test_runner.md +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/tests/__init__.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/tests/test_build_container_images.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/tests/test_pr_content.py +0 -0
- {github_rest_api-0.47.2 → github_rest_api-0.49.0}/tests/test_release_on_github.py +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: Auto Merge PR
|
|
2
|
+
on:
|
|
3
|
+
# The Claude review runs with `track_progress`, which creates its tracking
|
|
4
|
+
# comment when the review *starts* and then edits that same comment as the
|
|
5
|
+
# review progresses. The AUTO_MERGE_APPROVED marker therefore lands via an
|
|
6
|
+
# edit, so `issue_comment: created` fires far too early (the head commit is
|
|
7
|
+
# still seconds old and the marker is not written yet). Waiting for the review
|
|
8
|
+
# workflow to complete is what reliably lands after the marker exists and
|
|
9
|
+
# after the head-commit age gate has been cleared. The other PR checks
|
|
10
|
+
# are listed too because the merge gate additionally needs `mergeable_state
|
|
11
|
+
# == clean`, i.e. every check green -- whichever check finishes last is the
|
|
12
|
+
# one that makes the PR mergeable, and that is not always the review.
|
|
13
|
+
# Renaming any of these silently disables the trigger.
|
|
14
|
+
workflow_run:
|
|
15
|
+
workflows:
|
|
16
|
+
- Claude Code Review
|
|
17
|
+
- Lint Code
|
|
18
|
+
- Run Tests
|
|
19
|
+
types:
|
|
20
|
+
- completed
|
|
21
|
+
# Kept for approvals that come from a human rather than from Claude.
|
|
22
|
+
#
|
|
23
|
+
# `issue_comment: created` is deliberately absent: the only comment created on
|
|
24
|
+
# a PR here is the review's tracking comment, created seconds after the push,
|
|
25
|
+
# when the head commit is still under the age gate and the marker has not been
|
|
26
|
+
# written. It fired on every PR and could never merge anything. A marker typed
|
|
27
|
+
# by hand is picked up by the cron, or immediately via `workflow_dispatch`.
|
|
28
|
+
pull_request_review:
|
|
29
|
+
types:
|
|
30
|
+
- submitted
|
|
31
|
+
# Backstop for anything the event triggers miss.
|
|
32
|
+
schedule:
|
|
33
|
+
- cron: '0 * * * *'
|
|
34
|
+
timezone: 'America/Los_Angeles'
|
|
35
|
+
# Manual escape hatch. Run with `dry_run` to have the tool log its per-PR
|
|
36
|
+
# `Skipping auto-merge of PR #N: <reason>` verdicts without merging anything,
|
|
37
|
+
# which is the fastest way to diagnose why a PR is not being picked up.
|
|
38
|
+
workflow_dispatch:
|
|
39
|
+
inputs:
|
|
40
|
+
dry_run:
|
|
41
|
+
description: Log eligible PRs without merging them
|
|
42
|
+
type: boolean
|
|
43
|
+
default: false
|
|
44
|
+
permissions:
|
|
45
|
+
contents: write
|
|
46
|
+
pull-requests: write
|
|
47
|
+
concurrency:
|
|
48
|
+
# Every run rescans all open PRs, so overlapping runs are pure duplicate work
|
|
49
|
+
# and the newest run always sees the freshest state. Do not cancel in
|
|
50
|
+
# progress: a run cancelled midway through the merge API call is worse than a
|
|
51
|
+
# redundant one.
|
|
52
|
+
group: auto-merge-pull-request
|
|
53
|
+
cancel-in-progress: false
|
|
54
|
+
jobs:
|
|
55
|
+
auto_merge_pull_request:
|
|
56
|
+
# A triggering workflow that failed, was cancelled or was skipped left the
|
|
57
|
+
# PR unmergeable or wrote no marker, so there is nothing new to act on.
|
|
58
|
+
# This job checks out no PR code, so the elevated `workflow_run` context is
|
|
59
|
+
# never exposed to PR-controlled input.
|
|
60
|
+
if: |
|
|
61
|
+
github.event_name != 'workflow_run'
|
|
62
|
+
|| github.event.workflow_run.conclusion == 'success'
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
# The concurrency group above serializes every run, so a hung run would
|
|
65
|
+
# block all merges until the default 6h timeout.
|
|
66
|
+
timeout-minutes: 10
|
|
67
|
+
steps:
|
|
68
|
+
- name: Install uv
|
|
69
|
+
run: |
|
|
70
|
+
curl -LsSf https://astral.sh/uv/install.sh | sudo env UV_INSTALL_DIR="/usr/local/bin" sh
|
|
71
|
+
- name: Auto Merge PR
|
|
72
|
+
# `--allowed-types` is intentionally left at the upstream default
|
|
73
|
+
# (build, chore, ci, docs, deps) so that only simple PRs auto-merge;
|
|
74
|
+
# anything substantive, `feat` and `fix` included, is merged by hand.
|
|
75
|
+
run: |
|
|
76
|
+
uvx --from github-rest-api@latest auto_merge_pull_request \
|
|
77
|
+
--authors dclong \
|
|
78
|
+
--approvers dclong 'claude[bot]' 'gemini-code-assist[bot]' \
|
|
79
|
+
--marker 'AUTO_MERGE_APPROVED' \
|
|
80
|
+
${{ inputs.dry_run && '--dry-run' || '' }} \
|
|
81
|
+
--token ${{ secrets.ACTIONS_TOKEN }}
|
|
@@ -10,19 +10,25 @@ on:
|
|
|
10
10
|
# - "src/**/*.js"
|
|
11
11
|
# - "src/**/*.jsx"
|
|
12
12
|
|
|
13
|
+
concurrency:
|
|
14
|
+
group: claude-review-${{ github.event.pull_request.number }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
13
17
|
jobs:
|
|
14
18
|
claude-review:
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
|
|
19
|
+
# Only review non-draft PRs whose branch lives in this repository. A PR from
|
|
20
|
+
# a fork is attacker-controlled input, and reviewing one with the ACTIONS_TOKEN
|
|
21
|
+
# PAT below would let a crafted title/description prompt-inject the
|
|
22
|
+
# AUTO_MERGE_APPROVED marker into a comment attributed to an auto-merge approver.
|
|
23
|
+
if: |
|
|
24
|
+
github.event.pull_request.head.repo.full_name == github.repository
|
|
25
|
+
&& github.event.pull_request.draft == false
|
|
20
26
|
|
|
21
27
|
runs-on: ubuntu-latest
|
|
22
28
|
permissions:
|
|
23
29
|
contents: read
|
|
24
|
-
pull-requests:
|
|
25
|
-
issues:
|
|
30
|
+
pull-requests: write
|
|
31
|
+
issues: write
|
|
26
32
|
id-token: write
|
|
27
33
|
|
|
28
34
|
steps:
|
|
@@ -36,6 +42,13 @@ jobs:
|
|
|
36
42
|
uses: anthropics/claude-code-action@v1
|
|
37
43
|
with:
|
|
38
44
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
45
|
+
# Post the review comment with a token that has write access. Using the
|
|
46
|
+
# ACTIONS_TOKEN PAT also makes the comment (and its AUTO_MERGE_APPROVED
|
|
47
|
+
# marker) come from dclong, who is in the auto-merge approver allowlist.
|
|
48
|
+
github_token: ${{ secrets.ACTIONS_TOKEN }}
|
|
49
|
+
# Force tag mode so the action creates and updates a PR comment with the
|
|
50
|
+
# review; without this the code-review run posts nothing.
|
|
51
|
+
track_progress: true
|
|
39
52
|
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
|
|
40
53
|
plugins: 'code-review@claude-code-plugins'
|
|
41
54
|
prompt: |
|
|
@@ -45,12 +58,10 @@ jobs:
|
|
|
45
58
|
When the review is finished, decide whether this PR is safe to merge
|
|
46
59
|
automatically: it is safe only if the review surfaced no correctness bugs
|
|
47
60
|
and no other blocking issues (non-blocking style or cleanup suggestions do
|
|
48
|
-
not disqualify it). If and only if it is safe,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
comment rather than editing an existing one, so the marker's timestamp
|
|
54
|
-
follows the latest commit.
|
|
61
|
+
not disqualify it). If and only if it is safe, end your review with this
|
|
62
|
+
token alone on its own final line, exactly and verbatim:
|
|
63
|
+
AUTO_MERGE_APPROVED
|
|
64
|
+
Do not write this token anywhere else in your review, and do not write it
|
|
65
|
+
at all if you found any blocking issue.
|
|
55
66
|
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
56
67
|
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
"""GitHub REST APIs."""
|
|
2
2
|
|
|
3
3
|
from .github import (
|
|
4
|
+
UNSET,
|
|
5
|
+
IssueState,
|
|
6
|
+
IssueStateReason,
|
|
4
7
|
MergeMethod,
|
|
5
8
|
Organization,
|
|
6
9
|
Repository,
|
|
7
10
|
RepositoryType,
|
|
8
11
|
SecretVisibility,
|
|
12
|
+
Unset,
|
|
9
13
|
User,
|
|
10
14
|
)
|
|
11
15
|
|
|
12
16
|
__all__ = [
|
|
17
|
+
"UNSET",
|
|
18
|
+
"IssueState",
|
|
19
|
+
"IssueStateReason",
|
|
13
20
|
"MergeMethod",
|
|
14
21
|
"Organization",
|
|
15
22
|
"Repository",
|
|
16
23
|
"RepositoryType",
|
|
17
24
|
"SecretVisibility",
|
|
25
|
+
"Unset",
|
|
18
26
|
"User",
|
|
19
27
|
]
|