Skip to content

Commit 7f5b637

Browse files
authored
fix(ci): grant AI review contents write permission (#695)
1 parent b29edad commit 7f5b637

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from pathlib import Path
2+
3+
4+
WORKFLOW_PATH = Path(__file__).parents[2] / "workflows" / "ai-pr-review.yml"
5+
6+
7+
def test_ai_pr_review_caller_grants_reusable_workflow_permissions() -> None:
8+
workflow = WORKFLOW_PATH.read_text()
9+
10+
required_permissions = (
11+
" ai-pr-review:\n"
12+
" permissions:\n"
13+
" contents: write\n"
14+
" id-token: write\n"
15+
" pull-requests: write\n"
16+
)
17+
assert required_permissions in workflow

.github/workflows/ai-pr-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions: {}
99
jobs:
1010
ai-pr-review:
1111
permissions:
12-
contents: read
12+
contents: write
1313
id-token: write
1414
pull-requests: write
1515
uses: aws/aws-durable-execution-ci/.github/workflows/ai-pr-review.yml@8de63fa646c1b7b778829126cf53b7874074795e

.github/workflows/test-parser.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- '.github/scripts/check_otel_wheel_dependencies.py'
88
- '.github/scripts/parse_sdk_branch.py'
99
- '.github/scripts/tests/**'
10+
- '.github/workflows/ai-pr-review.yml'
1011
- '.github/workflows/opentelemetry-conformance-tests.yml'
1112
- 'packages/aws-durable-execution-sdk-python-otel/pyproject.toml'
1213
push:
@@ -16,6 +17,7 @@ on:
1617
- '.github/scripts/check_otel_wheel_dependencies.py'
1718
- '.github/scripts/parse_sdk_branch.py'
1819
- '.github/scripts/tests/**'
20+
- '.github/workflows/ai-pr-review.yml'
1921
- '.github/workflows/opentelemetry-conformance-tests.yml'
2022
- 'packages/aws-durable-execution-sdk-python-otel/pyproject.toml'
2123

@@ -34,6 +36,7 @@ jobs:
3436
- name: Run script tests
3537
run: |
3638
python -m pytest \
39+
.github/scripts/tests/test_ai_pr_review_workflow.py \
3740
.github/scripts/tests/test_build_lambda_layer.py \
3841
.github/scripts/tests/test_check_otel_wheel_dependencies.py \
3942
.github/scripts/tests/test_opentelemetry_conformance_workflow.py \

0 commit comments

Comments
 (0)