Repository navigation
87 lines (78 loc) · 2.71 KB
/
Copy pathpython-pr-check.yml
File metadata and controls
87 lines (78 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# This workflow is managed by gh actions-lock.
name: Python PR Check
on:
workflow_call:
inputs:
runner:
description: 'Runner label(s) for the workflow jobs'
type: string
default: 'ubuntu-latest'
test-dependencies:
description: 'Extra pip packages to install for the test run'
type: string
default: 'pytest pytest-asyncio pytest-cov'
pytest-args:
description: 'Additional arguments passed to pytest'
type: string
default: ''
run-pr-agent:
description: ''
type: boolean
default: false
secrets:
FEDERATION_RULE_ID:
description: 'Anthropic federation rule ID'
required: false
ORGANIZATION_ID:
description: 'Anthropic organization ID'
required: false
SERVICE_ACCOUNT_ID:
description: 'Anthropic service account ID'
required: false
WORKSPACE_ID:
description: 'Anthropic workspace ID'
required: false
permissions:
id-token: write
issues: write
pull-requests: write
contents: write
jobs:
test:
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.1
- name: Set up Python
uses: actions/setup-python@v7.1.0
with:
python-version-file: '.python-version'
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install ${{ inputs.test-dependencies }}
- name: Run pytest
run: pytest ${{ inputs.pytest-args }}
- name: Fetch Anthropic OIDC token
if: ${{ inputs.run-pr-agent == true}}
id: anthropic_token
uses: 96daysleft/github-workflows/.github/actions/anthropic-oidc-token@release
with:
federation-rule-id: ${{ secrets.FEDERATION_RULE_ID }}
organization-id: ${{ secrets.ORGANIZATION_ID }}
service-account-id: ${{ secrets.SERVICE_ACCOUNT_ID }}
workspace-id: ${{ secrets.WORKSPACE_ID }}
- name: PR Agent action step
if: ${{ inputs.run-pr-agent == true}}
uses: the-pr-agent/pr-agent@v0.48.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
config.model: "anthropic/claude-haiku-4-5-20251001"
config.fallback_models: '["anthropic/claude-sonnet-4-5-20250929"]'
ANTHROPIC.KEY: ${{ steps.anthropic_token.outputs.claude-token }}
github_action_config.pr_actions: '["opened", "reopened", "synchronize", "ready_for_review", "review_requested"]'
github_action_config.auto_review: "true"
github_action_config.auto_describe: "true"
github_action_config.auto_improve: "true"