aws / aws/bedrock-agentcore-sdk-python
CI pipeline does not trigger on release PRs created by github-actions[bot]
- Ngôn ngữ chính
- Python
- Star
- 761
- Fork
- 147
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 7
Mô tả
## Problem
Release PRs (e.g. #369) created by the `release-prepare.yml` workflow never get their CI checks (`ci.yml`) triggered. This blocks merging because the `main-status-checks` ruleset requires 10 status checks to pass:
- Lint and Format
- Test Python 3.10, 3.11, 3.12, 3.13
- Build Distribution
- Test Package Installation (3.10, 3.11, 3.12, 3.13)
## Root Cause
`release-prepare.yml` uses the default `GITHUB_TOKEN` to push the release branch and create the PR. GitHub intentionally does **not** trigger workflows from events created by `GITHUB_TOKEN` to prevent infinite loops. Since the branch push and PR creation come from `github-actions[bot]`, the `pull_request` event for `ci.yml` is silently skipped.
References:
- https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
## Secondary Issue
`pr-automerge.yml` checks for CI job names that don't match the actual names in `ci.yml`:
| pr-automerge.yml expects | ci.yml actual |
|---|---|
| `Lint` | `Lint and Format` |
| `Build Package` | `Build Distribution` |
Even if CI ran, the auto-merge would fail to find the correct check runs.
## Proposed Fix
### Option A: GitHub App token (recommended)
Use [`actions/create-github-app-token`](https://github.com/actions/create-github-app-token) in `release-prepare.yml` to generate a token from a GitHub App. Tokens from GitHub Apps **do** trigger downstream workflows.
```yaml
- name: Generate token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
```
Then use that token for the `git push` and `gh pr create` steps. This requires:
1. Creating a GitHub App with `contents: write` and `pull-requests: write` permissions
2. Installing it on the repo
3. Adding `APP_ID` and `APP_PRIVATE_KEY` as repo secrets
### Option B: Explicitly trigger CI (quick fix, no new secrets)
Add a step at the end of `release-prepare.yml` to manually trigger the CI workflow on the release branch:
```yaml
- name: Trigger CI on release branch
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run ci.yml --ref "release/v$NEW_VERSION"
```
This is simpler but is a workaround rather than a proper fix.
### Fix the name mismatch in pr-automerge.yml
Regardless of which option above is chosen, update the `requiredChecks` array in `pr-automerge.yml`:
```diff
const requiredChecks = [
- 'Lint',
+ 'Lint and Format',
'Test Python 3.10',
'Test Python 3.11',
'Test Python 3.12',
'Test Python 3.13',
- 'Build Package'
+ 'Build Distribution',
+ 'Test Package Installation (3.10)',
+ 'Test Package Installation (3.11)',
+ 'Test Package Installation (3.12)',
+ 'Test Package Installation (3.13)',
];
```
## Impact
Every release PR is affected. Currently requires manual intervention (pushing an empty commit or closing/reopening the PR) to trigger CI.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách đọc .github/workflows/release-prepare.yml, ci.yml và pr-automerge.yml, sau đó theo dõi cách release workflow push branch của nó và tạo pull request. So sánh hành vi trigger của các workflow và tên của các check bắt buộc; hoàn thành khi các release PR nhận được tất cả các CI check bắt buộc và auto-merge nhận diện các check được định nghĩa trong ci.yml.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- github-actions
- Lĩnh vực
- ci-cd, devops
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100