-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: validate .clasprc.json content and handle clasp login failure
- Loading branch information
Showing
1 changed file
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,22 @@ jobs: | |
id: install-clasp | ||
run: sudo npm install @google/[email protected] -g | ||
|
||
- name: Write CLASPRC_JSON secret to .clasp.json file | ||
- name: Write CLASPRC_JSON secret to .clasprc.json file | ||
id: write-clasprc | ||
run: | | ||
echo '${{ secrets.CLASPRC_JSON }}' > ~/.clasprc.json | ||
echo '{"scriptId":"${{ secrets.SCRIPT_ID }}"}' > .clasp.json | ||
- name: Validate .clasprc.json content | ||
id: validate-clasprc | ||
run: | | ||
if jq -e . ~/.clasprc.json >/dev/null 2>&1; then | ||
echo "Valid JSON in .clasprc.json" | ||
else | ||
echo "Invalid JSON in .clasprc.json" | ||
exit 1 | ||
fi | ||
- name: Check .clasp.json and .clasprc.json content | ||
id: check-clasp-files | ||
run: | | ||
|
@@ -32,7 +42,13 @@ jobs: | |
- name: Check clasp login status | ||
id: clasp_login | ||
run: clasp login --status || echo "Login failed, but continuing..." | ||
run: | | ||
if clasp login --status; then | ||
echo "Clasp login successful" | ||
else | ||
echo "Clasp login failed. Attempting to refresh token..." | ||
clasp login --no-localhost | ||
fi | ||
- name: Save current .clasp.json contents to CLASPRC_JSON_FILE environment variable | ||
id: save-clasprc | ||
|