Skip to content

Commit 11a0ab1

Browse files
authored
Checkout with token (#2041)
1 parent 7d5ea54 commit 11a0ab1

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

.github/workflows/upgrade-yarn.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,25 @@ jobs:
1616
id-token: 'write'
1717

1818
steps:
19+
- id: token
20+
run: |
21+
APP_TOKEN=$(
22+
./scripts/generate_signed_jwt.sh \
23+
--issuer "${{ secrets.GH_APP_ID }}" \
24+
--private-key "${{ secrets.GH_PRIVATE_KEY }}" \
25+
)
26+
27+
GITHUB_TOKEN=$(
28+
./scripts/github_install_token.sh \
29+
--app-token $APP_TOKEN \
30+
)
31+
32+
echo "::set-output name=APP_TOKEN::$GITHUB_TOKEN"
33+
echo "::set-output name=GITHUB_TOKEN::$GITHUB_TOKEN"
34+
1935
- uses: actions/checkout@v5
36+
with:
37+
token: ${{ steps.token.outputs.APP_TOKEN }}
2038

2139
- uses: google-github-actions/auth@v3
2240
with:
@@ -30,18 +48,7 @@ jobs:
3048
- env:
3149
GITHUB_TOKEN: ${{ github.token }}
3250
run: |
33-
APP_TOKEN=$(
34-
./scripts/generate_signed_jwt.sh \
35-
--issuer "${{ secrets.GH_APP_ID }}" \
36-
--private-key "${{ secrets.GH_PRIVATE_KEY }}" \
37-
)
38-
39-
GITHUB_TOKEN=$(
40-
./scripts/github_install_token.sh \
41-
--app-token $APP_TOKEN \
42-
)
43-
4451
./scripts/github_pull_request.sh \
45-
--app-token "$APP_TOKEN" \
46-
--github-token "$GITHUB_TOKEN" \
52+
--app-token "${{ steps.token.outputs.APP_TOKEN }}" \
53+
--github-token "${{ steps.token.outputs.GITHUB_TOKEN }}" \
4754
--commit-msg "chore: upgrade yarn lock"

scripts/github_pull_request.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eo pipefail
44

55
show_help() {
66
cat << EOF
7-
Usage: $(basename "$0") --app-token <APP_TOKEN> --commit-msg <COMMIT_MSG>
7+
Usage: $(basename "$0") --app-token <APP_TOKEN> --github-token <GITHUB_TOKEN> --commit-msg <COMMIT_MSG>
88
99
Automates the workflow of creating a branch, committing staged and unstaged changes, pushing to GitHub, and creating a PR.
1010

0 commit comments

Comments
 (0)