Skip to content

sourceallies/hacker-rank-queue

Repository files navigation

HackerRank Queue Slack Bot

Development

Make sure to have the following tools installed:

You will never have to run the code locally, other than to run tests.

pnpm verify

Deployments

See the .aws/README.md to setup your computer for deployments. Afterwords, you can simply run the following from any folder in the project:

# Sign into AWS dev
dev

# Deploy to dev
pnpm deploy

You don't have to commit anything before doing a deploy. Just make a change and deploy!

Workflow

This repo uses Conventional Commits. Here are the types of commits we use:

  • feat: ... - Used when the commit introduces a new feature
  • fix: ... - Fixing a bug in user facing code
  • chore: ... - Refactor, fixing lint or test errors, formatting, etc
  • ci: ... - When you update the CI (no example)
  • docs: ... - When you update the README.md or other documentation
  • BREAKING CHANGE: ... - When there's a feature that leads to a completely different flow for users (no example)

On feature branches, don't worry about doing conventional commits. Instead, just name the PR According to the patterns above, and scope it to just that one thing. When you squash and merge (the only allowed way to merge), the commit message will default to a conventional commit. Fill out a description if you want, but leave the title of the commit untouched.

Useful links

Running Locally

  1. Create a .env file at the root of the project and add the following entries

    INTERVIEWING_CHANNEL_ID=
    ERRORS_CHANNEL_ID=
    SPREADSHEET_ID=1ChOEjl5l_Uh5dTd_fRjGJt8z7bFNNOwPlzgRnhOLgTY
    REQUEST_EXPIRATION_MIN=15
    PORT=3000
    MODE=dev
    SLACK_BOT_TOKEN=
    SLACK_SIGNING_SECRET=
    GOOGLE_SERVICE_ACCOUNT_EMAIL=
    GOOGLE_PRIVATE_KEY=
    
    • INTERVIEWING_CHANNEL_ID, ERRORS_CHANNEL_ID, and SPREADSHEET_ID can be found in cdk.json
    • HACK_PARSER_BUCKET_NAME can be found in cdk.json
      • If provided as an empty string, the HackParser integration will be disabled.
    • SLACK_BOT_TOKEN, SLACK_SIGNING_SECRET, GOOGLE_SERVICE_ACCOUNT_EMAIL, and GOOGLE_PRIVATE_KEY come from AWS Secrets Manager
    • The GOOGLE_PRIVATE_KEY multi-line variable needs to be turned into a single line wrapped in quotes.
      • GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMIIEvQ\n-----END PRIVATE KEY-----"
  2. Create your own bot (optional)

    1. Within Slack create a new Bot with the following scopes
      1. chat:write
      2. chat:write.customize
      3. workflow.steps:execute
      4. commands
      5. users:read
      6. reactions:read
    2. The SLACK_BOT_TOKEN variable comes from the "OAuth Tokens for Your Workspace" section once the application has been installed into your test workspace.
  3. Install ngrok - brew install ngrok, start the application using ngrok http 3000 and make note of the URL.

  4. Put the URL + /slack/events into the "Interactivity & Shortcuts" page within the slack website for your app.