Skip to content

Commit

Permalink
fix: validate .clasprc.json content and handle clasp login failure
Browse files Browse the repository at this point in the history
  • Loading branch information
luandro committed Oct 19, 2024
1 parent 2deb188 commit 1b91d25
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down

0 comments on commit 1b91d25

Please sign in to comment.