Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/check_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading