Skip to content

Commit 407df59

Browse files
committed
fix: provide all required UserRefreshClient fields in clasprc to pass fromJSON validation
1 parent 277cb03 commit 407df59

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,19 @@ jobs:
5555
token_format: 'access_token'
5656
access_token_scopes: 'https://www.googleapis.com/auth/script.projects,https://www.googleapis.com/auth/drive.file,https://www.googleapis.com/auth/script.deployments'
5757

58-
# Write the access token to ~/.clasprc.json where clasp reads credentials.
59-
# expiry_date is set far in the future to prevent clasp attempting a refresh
60-
# (there is no refresh token — the 1-hour access token is sufficient for a push).
58+
# Write credentials to ~/.clasprc.json. UserRefreshClient.fromJSON() requires
59+
# type, client_id, client_secret, and refresh_token to be present or it throws.
60+
# client_id/client_secret are clasp's own public OAuth client (embedded in the
61+
# npm package). refresh_token is a dummy — it is never called because
62+
# expiry_date is far in the future, so the WIF access_token is used directly.
6163
# ACCESS_TOKEN is passed via env to avoid shell interpolation exposure.
6264
- name: Write clasp credentials
6365
env:
6466
ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
6567
run: |
6668
python3 -c "
6769
import json, os
68-
json.dump({'tokens': {'default': {'type': 'authorized_user', 'access_token': os.environ['ACCESS_TOKEN'], 'token_type': 'Bearer', 'expiry_date': 9999999999999}}}, open(os.path.expanduser('~/.clasprc.json'), 'w'))
70+
json.dump({'tokens': {'default': {'type': 'authorized_user', 'client_id': '1072944905499-vm2v2i5dvn0a0d2o4ca36i1vge8cvbn0.apps.googleusercontent.com', 'client_secret': 'v6V3fKV_zWU7iw1DrpO1rknX', 'refresh_token': 'not-used', 'access_token': os.environ['ACCESS_TOKEN'], 'token_type': 'Bearer', 'expiry_date': 9999999999999}}}, open(os.path.expanduser('~/.clasprc.json'), 'w'))
6971
"
7072
7173
# Build, copy dev clasp config, and push. Clasp reads credentials from
@@ -114,17 +116,19 @@ jobs:
114116
token_format: 'access_token'
115117
access_token_scopes: 'https://www.googleapis.com/auth/script.projects,https://www.googleapis.com/auth/drive.file,https://www.googleapis.com/auth/script.deployments'
116118

117-
# Write the access token to ~/.clasprc.json where clasp reads credentials.
118-
# expiry_date is set far in the future to prevent clasp attempting a refresh
119-
# (there is no refresh token — the 1-hour access token is sufficient for a push).
119+
# Write credentials to ~/.clasprc.json. UserRefreshClient.fromJSON() requires
120+
# type, client_id, client_secret, and refresh_token to be present or it throws.
121+
# client_id/client_secret are clasp's own public OAuth client (embedded in the
122+
# npm package). refresh_token is a dummy — it is never called because
123+
# expiry_date is far in the future, so the WIF access_token is used directly.
120124
# ACCESS_TOKEN is passed via env to avoid shell interpolation exposure.
121125
- name: Write clasp credentials
122126
env:
123127
ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
124128
run: |
125129
python3 -c "
126130
import json, os
127-
json.dump({'tokens': {'default': {'type': 'authorized_user', 'access_token': os.environ['ACCESS_TOKEN'], 'token_type': 'Bearer', 'expiry_date': 9999999999999}}}, open(os.path.expanduser('~/.clasprc.json'), 'w'))
131+
json.dump({'tokens': {'default': {'type': 'authorized_user', 'client_id': '1072944905499-vm2v2i5dvn0a0d2o4ca36i1vge8cvbn0.apps.googleusercontent.com', 'client_secret': 'v6V3fKV_zWU7iw1DrpO1rknX', 'refresh_token': 'not-used', 'access_token': os.environ['ACCESS_TOKEN'], 'token_type': 'Bearer', 'expiry_date': 9999999999999}}}, open(os.path.expanduser('~/.clasprc.json'), 'w'))
128132
"
129133
130134
# Build, copy prod clasp config, and push. Clasp reads credentials from

0 commit comments

Comments
 (0)