Skip to content

Instantly share code, notes, and snippets.

@maxlath
Created September 3, 2021 20:54
Show Gist options
  • Save maxlath/096fb50d3d9d8421dc404f278d057a6c to your computer and use it in GitHub Desktop.
Save maxlath/096fb50d3d9d8421dc404f278d057a6c to your computer and use it in GitHub Desktop.
Setup Wikidata OAuth credentials for wikibase-cli from environment variables
#!/usr/bin/env bash
# Assuming that the workflow yaml file sets the following
# env:
# WD_CONSUMER_KEY: ${{ secrets.WD_CONSUMER_KEY }}
# WD_CONSUMER_SECRET: ${{ secrets.WD_CONSUMER_SECRET }}
# WD_TOKEN: ${{ secrets.WD_TOKEN }}
# WD_TOKEN_SECRET: ${{ secrets.WD_TOKEN_SECRET }}
echo "{
\"credentials\": {
\"https://www.wikidata.org\": {
\"oauth\": {
\"consumer_key\": \"$WD_CONSUMER_KEY\",
\"consumer_secret\": \"$WD_CONSUMER_SECRET\",
\"token\": \"$WD_TOKEN\",
\"token_secret\": \"$WD_TOKEN_SECRET\"
}
}
}
}" > "$(wd config path)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment