Skip to content

Commit d5b2017

Browse files
authored
🔐 Use PR Submit for pull requests (#2411)
1 parent 9097b32 commit d5b2017

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

.github/pr-submit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
workflows:
2+
- .github/workflows/bump-pre-commit-hooks.yml

.github/workflows/bump-pre-commit-hooks.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ jobs:
1212
if: github.repository_owner == 'fastapi'
1313
runs-on: ubuntu-latest
1414
timeout-minutes: 10
15+
permissions:
16+
contents: read
17+
id-token: write
1518
steps:
1619
- name: Dump GitHub context
1720
env:
1821
GITHUB_CONTEXT: ${{ toJson(github) }}
1922
run: echo "$GITHUB_CONTEXT"
2023
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2124
with:
22-
token: ${{ secrets.LATEST_CHANGES }}
23-
persist-credentials: true
25+
persist-credentials: false
2426
- name: Set up Python
2527
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
2628
with:
@@ -36,22 +38,26 @@ jobs:
3638
uv.lock
3739
- name: Bump pre-commit hooks
3840
run: uv run prek auto-update --freeze --cooldown-days 7
41+
- name: Get PR Submit token
42+
id: pr-submit
43+
uses: tiangolo/pr-submit@d802fdf59bde80bc3eb8bd3259f4cbeec63de4aa # 0.0.1
3944
- name: Create pull request
4045
env:
41-
GH_TOKEN: ${{ secrets.LATEST_CHANGES }}
46+
GH_TOKEN: ${{ steps.pr-submit.outputs.token }}
4247
BASE_BRANCH: ${{ github.event.repository.default_branch }}
4348
run: |
4449
set -euo pipefail
4550
if git diff --quiet; then
4651
echo "No pre-commit hook updates available"
4752
exit 0
4853
fi
49-
git config user.name "github-actions[bot]"
50-
git config user.email "github-actions[bot]@users.noreply.github.com"
54+
git config user.name "pr-submit[bot]"
55+
git config user.email "pr-submit[bot]@users.noreply.github.com"
5156
branch="bump-pre-commit-hooks"
5257
git switch -C "$branch"
5358
git add .pre-commit-config.yaml
5459
git commit -m "⬆ Bump pre-commit hooks"
60+
gh auth setup-git
5561
git push --force origin "$branch"
5662
if [ -z "$(gh pr list --head "$branch" --state open --json number --jq '.[].number')" ]; then
5763
gh pr create \

0 commit comments

Comments
 (0)