Skip to content

Commit

Permalink
Removes github PR graphQL logic and updates team members and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyjohn2015 committed Nov 6, 2023
1 parent bba3d6e commit 0293db4
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 405 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SPGITHUB_TOKEN: ${{ secrets.SPGITHUB_TOKEN }}
SLOTH_WEBHOOK: ${{ secrets.SLOTH_WEBHOOK }}
RURU_WEBHOOK: ${{ secrets.RURU_WEBHOOK }}
GIRAFFE_WEBHOOK: ${{ secrets.GIRAFFE_WEBHOOK }}
CSTEAM_WEBHOOK: ${{ secrets.CSTEAM_WEBHOOK }}
run: |
echo "SPGITHUB_TOKEN=$SPGITHUB_TOKEN" > ./.env
echo "SLOTH_WEBHOOK=$SLOTH_WEBHOOK" >> ./.env
echo "RURU_WEBHOOK=$RURU_WEBHOOK" >> ./.env
echo "GIRAFFE_WEBHOOK=$GIRAFFE_WEBHOOK" >> ./.env
echo "CSTEAM_WEBHOOK=$CSTEAM_WEBHOOK" >> ./.env
mkdir ~/.aws
echo "[weka-deploy]" > ~/.aws/credentials
Expand All @@ -30,9 +24,6 @@ jobs:
echo "[profile weka-deploy]" > ~/.aws/config
echo "region=ap-southeast-2" >> ~/.aws/config
npm install
npx arc env production SPGITHUB_TOKEN $SPGITHUB_TOKEN
npx arc env production SLOTH_WEBHOOK $SLOTH_WEBHOOK
npx arc env production RURU_WEBHOOK $RURU_WEBHOOK
npx arc env production GIRAFFE_WEBHOOK $GIRAFFE_WEBHOOK
npx arc env production CSTEAM_WEBHOOK $CSTEAM_WEBHOOK
npm run deploy --production
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,31 @@

[![Storybot Deploy](https://github.com/storypark/storybot/actions/workflows/main.yml/badge.svg)](https://github.com/storypark/storybot/actions/workflows/)

## Powering Giraffe and Weka squads in Slack
## Powering Storypark squads in Slack

Currently consists of two scheduled tasks, one for the morning standup and one for the afternoon stand-down. They live in src/scheduled.
Currently consists of two scheduled tasks, one for the morning standup and one for the afternoon stand-down.
They live in src/scheduled.

Most of the code is in /shared to keep things DRY. Don't expect anything life-changing!

The Github access is done using their GraphQL API.

## Deploying to AWS

You'll need an AWS profile called `weka-deploy` set up in your `~/.aws/credentials`. You'll also need to set up a few environment variables:
You'll need an AWS profile called `weka-deploy` set up in your `~/.aws/credentials`.
See 1pass for details.

| Variable | Description |
| -------- | ----------- |
| \<team\>_WEBHOOK | The full URL of the Slack webhook to use for sending messages. Check `src/shared/config.js` for valid teams|
| SPGITHUB_TOKEN | Github token to use when searching for PR info. |
You'll also need to set an environment variable:
SLOTH_WEBHOOK=true
or
CSTEAM_WEBHOOK=true

These should be put in a `.env` file at the root of the project. Process.Env is used to pick these up. The `.env` is in `.gitignore` so it can't be checked in. The production values are stored as secrets in the Github Repo itself - you can overwrite them, but not view them.
This is the full URL of the Slack webhook to use for sending messages. Check `src/shared/config.js` for valid teams|

Once you have that in place you can run
These should be put in a `.env` file at the root of the project.
Process.Env is used to pick these up.
The `.env` is in `.gitignore` so it can't be checked in.
The production values are stored as secrets in the Github Repo itself - you can overwrite them, but not view them.

Once you have that in place you can run
```
npm install
npm run deploy
Expand All @@ -31,4 +35,5 @@ npm run deploy
Which will deploy the Staging stack. Add `--production` to deploy to the Production stack.

## New Starters
Update `src/shared/users.js` with your github username and slack id, and if you're feeling adventurous update your team's config in `src/shared/config.js`
Update `src/shared/users.js` with your github username and slack id,
and if you're feeling adventurous update your team's config in `src/shared/config.js`
29 changes: 0 additions & 29 deletions src/http/get-prs/index.js

This file was deleted.

45 changes: 0 additions & 45 deletions src/http/post-command-prs/index.js

This file was deleted.

104 changes: 0 additions & 104 deletions src/http/post-command-prs/package-lock.json

This file was deleted.

21 changes: 0 additions & 21 deletions src/http/post-command-prs/package.json

This file was deleted.

31 changes: 0 additions & 31 deletions src/scheduled/daily-standup/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { users } = require('@architect/shared/users');
const config = require('@architect/shared/config');
const standup = require('@architect/shared/standup');
const pullRequests = require('@architect/shared/pullRequests');
const slackMessage = require('@architect/shared/slackMessage');
const shouldIRun = require('@architect/shared/shouldIRun');

Expand All @@ -18,36 +17,6 @@ exports.handler = async function() {
];

console.log('Standup text generated');

if (team.showPRs) {
console.log('Generating PR info');

text.push(await pullRequests({
users,
labels: ['1. Ready for code review'],
message: 'Pull requests with code review label that still need reviewers:',
filterCriteria: (pr) => pr.author && pr.assignees.length < 2
}));

console.log('Added PRs waiting for reviewers');

text.push(await pullRequests({
users,
labels: ['1. Ready for code review'],
message: 'Pull requests currently in review:',
filterCriteria: (pr) => pr.author && pr.assignees.length === 2
}));

console.log('Added PRs currently in review');

text.push(await pullRequests({
users,
labels: ['3. Ready for testing', 'Combo'],
message: 'Pull requests in testing that still have people assigned:',
filterCriteria: (pr) => pr.author && pr.assignees.length > 0
}));
}

console.log('Posting to slack');

return slackMessage(team, { text: text.filter(v => v).join("\n\n") });
Expand Down
1 change: 0 additions & 1 deletion src/scheduled/daily-standup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"_parsed": [
"index.js",
"src/shared/config.js",
"src/shared/pullRequests.js",
"src/shared/shouldIRun.js",
"src/shared/shuffle.js",
"src/shared/slackMessage.js",
Expand Down
39 changes: 0 additions & 39 deletions src/shared/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@ const wekaStandup = (main, backup) => `Today's Chief Weka is :bird: :crown: ${ma
They'll be responsible for facilitating our standup meeting at 11.30.
If they aren't available, the Backup Weka is :bird: ${backup} :bird:`;

const giraffeStandup = (main, backup) => `Today's Prophet of the Giraffes is :giraffe_face: :crown: ${main} :crown: :giraffe_face:
They'll be responsible for facilitating our standup meeting at 9.30.
If they aren't available, the backup giraffe is :giraffe_face: ${backup} :giraffe_face:
Standup will happen on the <https://miro.com/app/board/o9J_l4Tqg8E=/|Horizon 2 Miro board>.
If you need inspiration for the question of the day, <https://andyhansen.co.nz/posts/stand-up-bonus-question|this> or <https://rendall.github.io/icebreakers/|this> are great.`;

const ruruStandup = (main, backup) => `Today's Chief Owl is :ruru: :crown: ${main} :crown: :ruru:
They'll be responsible for facilitating our standup meeting at 9.15.
If they aren't available, the Backup Owl is :ruru: ${backup} :ruru:
*1.* What is blocking you?
*2.* What help do you need?
*3.* What comms need to happen?
*4.* Activity of the day: Share a joke, a book/song/show/movie you like, do some stretching, have a dance-off, or ask a <https://learnhip.com/randomq/|question of the day>.
Standup will be run against the <https://trello.com/b/C73E32CS/ruru|Ruru Trello board>`;

const csTeamStandup = (main, backup) => `Today's Chief is :crown: ${main} :crown:
They'll be responsible for facilitating our standup meeting at 9.30.
If they aren't available, the Backup is ${backup}.
Expand All @@ -48,32 +28,13 @@ module.exports = [
5: ['nat'],
},
standupMessage: wekaStandup,
showPRs: false,
webhookEnvVar: 'SLOTH_WEBHOOK',
// paused: true,
},
{
name: 'giraffes',
standupCaptains: ['katie', 'shannon', 'gavin', 'andrew', 'sarah', 'chron'],
onlyOnDays: [2, 4, 5],
standupMessage: giraffeStandup,
showPRs: false,
webhookEnvVar: 'GIRAFFE_WEBHOOK',
paused: true,
},
{
name: 'ruru',
standupCaptains: ['libbyschuknight', 'marielleaurabelle', 'Rob-Bee-Neilson'],
standupMessage: ruruStandup,
showPRs: false,
webhookEnvVar: 'RURU_WEBHOOK',
paused: true,
},
{
name: 'csteam',
standupCaptains: ['geena', 'kerry', 'david', 'erika', 'sabeena'],
standupMessage: csTeamStandup,
showPRs: false,
webhookEnvVar: 'CSTEAM_WEBHOOK',
// paused: true,
}
Expand Down
Loading

0 comments on commit 0293db4

Please sign in to comment.