You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve user experience for setting up environment variables (#21)
Setup dotenv to load environment variables from a `.env` file instead of assuming the user
knows how to set environment variables in their shell on their own. Updated the README instructions
to make it much more clear and explicit for how users should set their environment variables.
Test Plan: Without any environment variables set:
1. Enable the "sourcecred/github" plugin
2. Add your github token to the `.env` file
3. Run `yarn load` and ensure that it successfully reads the token and loads github data into the cache.
Update the configuration files according to the plugin guides below.
57
+
3. If you are using the GitHub or Discord plugin, copy the `.env.example` file to a `.env` file:
58
+
```shell script
59
+
cp .env.example .env
60
+
```
61
+
62
+
4. Follow the steps in the [plugin guides below](#supported-plugins) to setup the config files and generate access tokens
63
+
for each plugin and then paste them into the `.env` file after the `=` sign.
64
+
58
65
59
-
Then, run the following commands to update the instance:
66
+
5. Run the following commands to update the instance:
60
67
61
-
-`yarn load [...plugins]` loads the cache. By default, it loads all
62
-
plugins, or it can load only specific plugins if requested.
63
-
-`yarn graph` regenerates plugin graphs from the cache;
64
-
these graphs get saved in `output/`.
65
-
-`yarn score` computes Cred scores, combining data from all the chosen
66
-
plugins
68
+
-`yarn load` loads the data from each plugin into the cache
69
+
-`yarn graph` regenerates plugin graphs from the cache; these graphs get saved in `output/`.
70
+
-`yarn score` computes Cred scores, combining data from all the chosen plugins
67
71
-`yarn grain` distributes Grain according to the current Cred scores, and the config in `config/grain.json`
68
72
69
73
**Generate the frontend:**
@@ -95,8 +99,6 @@ commit and push your changes to master (or make a pull request). The Github Acti
95
99
and deploy it to GitHub Pages. To enable GitHub Pages for your instance, check out [this guide](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site).
96
100
Make sure you select `gh-pages` as the branch to publish from.
97
101
98
-
99
-
100
102
# Supported Plugins
101
103
102
104
## GitHub
@@ -107,9 +109,9 @@ You can specify the repositories to load in
107
109
`config/plugins/sourcecred/github/config.json`.
108
110
109
111
The Github Action automatically has its own GITHUB_TOKEN, but if you need to load data from the
110
-
GitHub plugin locally, you must have a GitHub API key in your environment as
111
-
`$SOURCECRED_GITHUB_TOKEN`. The key should be read-only without any special
112
-
permissions (unless you are loading a private GitHub repository, in which case
112
+
GitHub plugin locally, you must have a GitHub API key in your `.env` file as
113
+
`SOURCECRED_GITHUB_TOKEN=<token>` (copy the `.env.example` file for reference). The key should be read-only without any special
114
+
scopes or permissions (unless you are loading a private GitHub repository, in which case
113
115
the key needs access to your private repositories).
114
116
115
117
You can generate a GitHub API key [here](https://github.com/settings/tokens).
@@ -121,8 +123,13 @@ keys or permissions. You just need to set the server url in `config/plugins/sour
121
123
122
124
## Discord
123
125
124
-
The Discord plugin loads Discord servers, and mints Cred on Discord reactions.
125
-
For instructions on configuring the Discord plugin, see the [Discord plugin page](https://sourcecred.io/docs/beta/plugins/discord/#configuration) in the SourceCred documentation.
126
+
The Discord plugin loads Discord servers, and mints Cred on Discord reactions. In order for SourceCred to
127
+
access your Discord server, you need to generate a "bot token" and paste it in the `.env` file as
128
+
`SOURCECRED_DISCORD_TOKEN=<token>` (copy the `.env.example` file for reference). You will also need to add it
129
+
to your GitHub Action secrets.
130
+
131
+
The full instructions for setting up the Discord plugin can be found in the [Discord plugin page](https://sourcecred.io/docs/beta/plugins/discord/#configuration)
0 commit comments