diff --git a/.github/workflows/check_auth.yml b/.github/workflows/check_auth.yml index fc63774..c1503c4 100644 --- a/.github/workflows/check_auth.yml +++ b/.github/workflows/check_auth.yml @@ -34,14 +34,20 @@ jobs: echo '${{ secrets.CONFIG_JSON }}' > $HOME/.silverfin/config.json - name: Refresh tokens run: | - CONFIG_JSON=$(cat $HOME/.silverfin/config.json) - for FIRM_ID in $(echo $CONFIG_JSON | jq 'del(.defaultFirmIDs, .host) | keys[]'); do - FIRM_ID=$(echo $FIRM_ID | tr -d '"') + CONFIG_PATH="$HOME/.silverfin/config.json" + CONFIG_JSON=$(cat "$CONFIG_PATH") + for FIRM_ID in $(echo "$CONFIG_JSON" | jq 'del(.defaultFirmIDs, .host) | keys[]'); do + FIRM_ID=$(echo "$FIRM_ID" | tr -d '"') if [[ -n "$FIRM_ID" && "$FIRM_ID" =~ ^[0-9]+$ ]]; then echo "[Action] refreshing token for firm $FIRM_ID" - node ./node_modules/silverfin-cli/bin/cli.js config --refresh-token $FIRM_ID + node ./node_modules/silverfin-cli/bin/cli.js config --refresh-token "$FIRM_ID" fi done + CONFIG_JSON=$(cat "$CONFIG_PATH") + for PARTNER_ID in $(echo "$CONFIG_JSON" | jq -r '.partnerCredentials // {} | keys[]'); do + echo "[Action] refreshing partner API key for partner $PARTNER_ID" + node ./node_modules/silverfin-cli/bin/cli.js config --refresh-partner-token "$PARTNER_ID" + done - name: Prepare and store updated CONFIG_JSON as secret run: | CONFIG_JSON=$(cat $HOME/.silverfin/config.json | tr -d '\n') diff --git a/README.md b/README.md index 3539185..fffcbe3 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ _Steps:_ * Installs the latest silverfin-cli version * Loads the CONFIG_JSON file from the secrets * Refreshes the tokens for all configured firms +* Refreshes partner API keys for each key in `partnerCredentials` when that object is present (otherwise skips) * Updates the CONFIG_JSON file secret with the refreshed tokens