FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
project logo
charmaineGitHub-PR-Automation
Automate GitHub PR workflows!
Public
Like
1
GitHub-PR-Automation
Home
Code
6
README.md
H
github-pr-auto-assign.ts
H
github-pr-inherit-labels.ts
H
github-pr-title-prefix.ts
H
github-slack-pr-approvals.ts
H
slack-github-bug-connector.ts
Branches
1
Pull requests
Remixes
1
History
Environment variables
5
Settings
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
https://charmaine--cb9f33642a2211f0854e569c3dd06744.web.val.run
README.md

GitHub PR Automation

This val includes several tools for automating GitHub pull request workflows:

  1. PR Auto-Assign: Automatically assigns the PR author as an assignee when a PR is opened
  2. PR Title Prefixer: Automatically prefixes PR titles with the linked issue number
  3. PR Label Inheritor: Automatically copies labels from linked issues to the PR
  4. PR Approval Notifier: Sends notifications to Slack when a PR is approved, with an optional merge button
  5. Slack-GitHub Bug Connector: Finds related GitHub issues when a bug is reported in Slack

PR Automation Vals

See all 3 in actionπŸ‘‡ Assignee_Label.gif

1. PR Auto-Assign

The github-pr-auto-assign.ts file automatically assigns the PR author as an assignee when a PR is opened.

Setup:

  • Create a GitHub webhook with the "Pull requests" event
  • Point it to the auto-assign file URL
  • Add GITHUB_TOKEN as an environment variable in Val Town with these permissions:
    • For classic tokens: Include the "repo" scope
    • For fine-grained tokens: Ensure "Pull requests" has "Read and Write" access
    • Token must be created by a user with write access to the repository

2. PR Title Prefixer

The github-pr-title-prefix.ts file automatically prefixes PR titles with the linked issue number (inline, in the description) when a PR is opened or edited.

Setup:

  • Create a GitHub webhook with the "Pull requests" event
  • Point it to the title prefixer file URL
  • Ensure your GitHub token has appropriate permissions

3. PR Label Inheritor

The github-pr-inherit-labels.ts file automatically copies labels from linked issues to the PR when a PR is opened or edited.

Setup:

  • Create a GitHub webhook with the "Pull requests" event
  • Point it to the label inheritor file URL
  • Ensure your GitHub token has appropriate permissions

PR Approval Notifier for Slack

The github-slack-pr-approval.ts file sends notifications to Slack when a GitHub pull request is approved, with an optional merge button that appears when all required checks are passing.

See this in actionπŸ‘‡ GitHubSlack.gif

Setup Instructions

1. GitHub Setup

  1. Create a GitHub Personal Access Token (PAT):

    • Go to GitHub β†’ Settings β†’ Developer settings β†’ Personal access tokens β†’ Fine-grained tokens
    • If this is not a personal repo, make sure to change the Resource owner from your personal account to your organization. Get the org admin to approve it at https://github.com/organizations/[YOUR_ORG_NAME}/settings/personal-access-token-requests.
    • If you're using GitHub Enterprise, follow these instructions
    • Create a new token with these permissions:
      • Repository access: Select repositories you want to monitor
      • Permissions:
        • Pull requests: Read and Write
        • Contents: Read and Write (for merging)
        • Metadata: Read-only
    • Save the token for the next step
  2. Set up a GitHub Webhook:

    • Go to your repository β†’ Settings β†’ Webhooks β†’ Add webhook
    • Payload URL: The URL of the respective file
    • Content type: application/json
    • Select "Let me select individual events"
    • Check only "Pull request reviews"
    • Ensure "Active" is checked
    • Click "Add webhook"

2. Slack Setup

  1. Create a Slack App:

    • Go to Slack API Apps β†’ Create New App β†’ From scratch
    • Name your app and select your workspace
    • Click "Create App"
  2. Enable Interactivity:

    • In your Slack app settings, go to "Interactivity & Shortcuts"
    • Toggle "Interactivity" to On
    • Set the Request URL to the URL of the respective file
    • Save Changes
  3. Create an Incoming Webhook:

    • In your Slack app settings, go to "Incoming Webhooks"
    • Toggle "Activate Incoming Webhooks" to On
    • Click "Add New Webhook to Workspace"
    • Select the channel where notifications should be posted
    • Copy the Webhook URL for the next step

3. Val Town Setup

  1. Add Environment Variables:

    • In Val Town, add these environment variables:
      • GITHUB_TOKEN: Your GitHub Personal Access Token
      • SLACK_WEBHOOK_URL: Your Slack Incoming Webhook URL
  2. Get the Val URL:

    • Copy the file's URL to use in the GitHub webhook and Slack app settings

Slack-GitHub Bug Connector

The slack-github-bug-connector.ts file automatically finds and comments with related GitHub issues when a new bug is reported in a Slack channel.

How It Works

  1. When a new message is posted in a configured Slack channel (ie. #bugs, or #support), Slack sends an event to this Val
  2. The val makes an OpenAI call to determine if the message is a bug
  3. If it is, then it searches GitHub for semantically related open issues with a separate OpenAI call
  4. It posts a comment in the Slack thread with links to related GitHub issues, with a "Relevance Score"

Setup Instructions

  1. Configure Environment Variables in Val Town:

    • SLACK_BOT_TOKEN: Your Slack Bot User OAuth Token (starts with xoxb-)
    • GITHUB_TOKEN: A GitHub Personal Access Token with repo scope
    • GITHUB_REPO: The GitHub repository to search in format owner/repo
  2. Set Up Slack App:

    • Create a new Slack App with Bot Token Scopes: chat:write, channels:history, groups:history
    • Set up Event Subscriptions with the Val's HTTP URL as the Request URL
    • Subscribe to the message.channels and message.groups bot events
    • Install the app to your workspace
    • Go to the channel you would like to add this integration to, type /app to pull up the Add apps to your workspace modal
    • Add the Slack App
    • Write up a bug in channel, and it will respond with related GitHub issues
HTTP
  • github-pr-auto-assign.ts
    charmaine--cb9f33642a2211f0854e569c3dd06744.web.val.run
  • github-pr-inherit-labels.ts
    charmaine--647d850e2a2311f09f48569c3dd06744.web.val.run
  • github-pr-title-prefix.ts
    charmaine--4de773ae2a2311f09e91569c3dd06744.web.val.run
  • github-slack-pr-approvals.ts
    charmaine--2cbbbe6a2a2311f0af26569c3dd06744.web.val.run
  • slack-github-bug-connector.ts
    charmaine--dea771ae367711f0ab2c9e149126039e.web.val.run
Code
README.md
H
github-pr-auto-assign.ts
H
github-pr-inherit-labels.ts
H
github-pr-title-prefix.ts
H
github-slack-pr-approvals.ts
H
slack-github-bug-connector.ts
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
Β© 2025 Val Town, Inc.