Skip to content

Commit 738ebc2

Browse files
authored
feat!: make slack message more helpful and configurable (closes #239)
previously the slack message on github deploy passed only a few variables and was less customizable. this breaks individual fields into different variables that can be processed and formatted separately. **This will be a breaking change because users will need to update their Slack workflows to support these new variables. In addition, users will need to update the .env.deploy.local file to include a new workflow endpoint. Run `npm run upload_config` to provide those to github actions.**
1 parent 65fcdc5 commit 738ebc2

2 files changed

Lines changed: 31 additions & 5 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,13 @@ jobs:
235235
# This data can be any valid JSON from a previous step in the GitHub Action
236236
payload: |
237237
{
238+
"deploy_base": "https://${{ secrets.EXP_DEPLOY_HOST }}${{ steps.dotenv_github.outputs.VITE_DEPLOY_BASE_PATH }}",
239+
"deploy_base_codename": "https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }}",
238240
"github_username": "${{ github.actor }}",
239-
"deploy_url": "https://${{ secrets.EXP_DEPLOY_HOST }}${{ steps.dotenv_github.outputs.VITE_DEPLOY_BASE_PATH }} although you should tell people https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }} . Your QR Code is to the site is here: https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }}/qr.svg",
240-
"github_hash": "https://github.com/${{ steps.dotenv_github.outputs.VITE_GIT_OWNER }}/${{ steps.dotenv_github.outputs.VITE_GIT_REPO_NAME }}/commit/${{ steps.dotenv_github.outputs.VITE_GIT_HASH }}"
241+
"github_hash": "https://github.com/${{ steps.dotenv_github.outputs.VITE_GIT_OWNER }}/${{ steps.dotenv_github.outputs.VITE_GIT_REPO_NAME }}/commit/${{ steps.dotenv_github.outputs.VITE_GIT_HASH }}",
242+
"qr_code": "https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }}/qr.svg",
243+
"prolific_url": "https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }}/#/welcome/prolific/",
244+
"cloudresearch_url": "https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }}/#/welcome/cloudresearch/",
245+
"mturk_url": "https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }}/#/welcome/mturk/",
246+
"citizen_url": "https://${{ secrets.EXP_DEPLOY_HOST }}/e/${{ steps.dotenv_github.outputs.VITE_CODE_NAME }}/#/welcome/citizen/"
241247
}

docs/labconfig.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,10 @@ Next, select "Webhook" as the type of workflow you are creating.
266266

267267
![Slack config](/images/labconfig-slack2.png)
268268

269-
Click add variables and add the following three variable names to your workflow
270-
(`github_username`, `deploy_url`, and `github_hash`):
269+
Click add variables and add the following variable names to your workflow
270+
`deploy_base`, `deploy_base_codename`, `github_username`,`github_hash`,
271+
`qr_code`, `prolific_url`, `cloudresearch_url`, `mturk_url`, `citizen_url`. This
272+
screenshot shows only a subset being added:
271273

272274
![Slack config](/images/labconfig-slack3.png)
273275

@@ -278,7 +280,25 @@ for fun):
278280

279281
![Slack config](/images/labconfig-slack4.png)
280282

281-
Click save and you'll see your settings like this:
283+
Here is an example you could build from (with placeholder values for the
284+
variables, you have to click the "Insert a variable" button in the Slack UI to
285+
add the variables to the message):
286+
287+
```
288+
:robot_face: Hi, github_username just automatically deployed an experiment to deploy_base. Hooray!
289+
290+
- Prolific URL: prolific_url
291+
- CloudResearch URL: cloudresearch_url
292+
- MTurk URL: mturk_url
293+
- Citizen URL: citizen_url
294+
295+
QR Code: qr_code
296+
The GitHub hash for this commit: github_hash
297+
```
298+
299+
Click save and you'll see get something like this (although Slack updates the UI
300+
slightly differently over time):
301+
282302
![Slack config](/images/labconfig-slack5.png)
283303

284304
You can make some changes here, including making a custom icon for your bot,

0 commit comments

Comments
 (0)