Skip to content

A Slack slash command that fetches GitHub PR info and posts a formatted message.

Notifications You must be signed in to change notification settings

webuild-ai/pr-slacker

Repository files navigation

Luna the PR Slacker PR Slacker

A Slack slash command that fetches GitHub PR info and posts a formatted message.

Usage

/pr <github-pr-url> [@reviewer] [message]

Examples:

/pr https://github.com/owner/repo/pull/123
/pr https://github.com/owner/repo/pull/123 @luna
/pr https://github.com/owner/repo/pull/123 @luna please review when you have time

Output:

NEW PR by @author - PR title
Commits: 1
Files Changed: 3
Insertions: +42 Deletions: -10
@luna please review when you have time

Setup

1. Create a Slack App

  1. Go to https://api.slack.com/apps and create a new app
  2. Add the slash command /pr under Slash Commands
  3. Add the chat:write OAuth scope under OAuth & Permissions
  4. Install the app to your workspace
  5. Copy the Signing Secret (Basic Information) and Bot Token (OAuth & Permissions)

2. Create a GitHub Token

  1. Go to https://github.com/settings/tokens
  2. Create a token with repo scope (or public_repo for public repos only)

3. Configure GitHub Secrets

Add these secrets to your repository (Settings → Secrets and variables → Actions):

Secret Description
AWS_ACCESS_KEY_ID AWS IAM access key
AWS_SECRET_ACCESS_KEY AWS IAM secret key
SLACK_SIGNING_SECRET From Slack app Basic Information
SLACK_BOT_TOKEN Bot User OAuth Token (xoxb-...)
GH_PAT GitHub personal access token

4. Deploy

Push to main branch to trigger automatic deployment via GitHub Actions.

Or deploy manually:

export AWS_ACCESS_KEY_ID=your_key
export AWS_SECRET_ACCESS_KEY=your_secret
export SLACK_SIGNING_SECRET=your_signing_secret
export SLACK_BOT_TOKEN=xoxb-your-token
export GITHUB_TOKEN=ghp_your_token

npm install
npm run deploy

5. Configure Slack Slash Command URL

After deployment, copy the API Gateway URL from the serverless output and set it as the Request URL for your slash command:

https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/slack/pr

Development

npm install      # Install dependencies
npm run build    # Compile TypeScript

About

A Slack slash command that fetches GitHub PR info and posts a formatted message.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published