GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - CodeYourFuture/gitbot: Integrating GitHub and Slack via Netlify

BranchesTags
Open more actions menu

Latest commit

 

History

209 Commits
209 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.vscode
.vscode
 
 
public
public
 
 
src
src
 
 
.gitignore
.gitignore
 
 
.npmrc
.npmrc
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
eslint.config.js
eslint.config.js
 
 
netlify.toml
netlify.toml
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
setupTests.ts
setupTests.ts
 
 
sonar-project.properties
sonar-project.properties
 
 
tsconfig.build.json
tsconfig.build.json
 
 
tsconfig.json
tsconfig.json
 
 
vite.config.js
vite.config.js
 
 

Repository files navigation

CYF GitBot

Node.js CI Maintainability Rating

Integrating GitHub and Slack via Netlify.

What is this?

Learners often accidentally create repositories in the CYF GitHub organization. This leads to lots of excess repos and makes it hard to manage the org.

A webhook in GitHub is configured to send all relevant events* in the CYF org to a Netlify function (in CYF's account).

The function in turn interacts with Slack to post messages notifying organization owners of any new repository, allowing them to review and (if necessary) delete the new repository.

* "Repository created, deleted, archived, unarchived, publicized, privatized, edited, renamed, or transferred."

Architecture

The sequence diagram below shows the series of events and calls.

sequenceDiagram
    actor Learner
    participant GitHub
    participant Netlify
    participant Slack
    Learner->>GitHub: Create repo CodeYourFuture/{name}
    GitHub->>+Netlify: POST /repo_event
    Netlify->>+Slack: POST /chat.postMessage
    Note right of Slack: Post in #35;cyf-github-owners
    Slack-->>-Netlify: 200 OK
    Netlify-->>-GitHub: 200 OK
    actor Admin
    alt Delete the repo
    Admin->>Slack: Click "Delete repo"
    Slack->>+Netlify: POST /slack_interaction
    Netlify->>+GitHub: DELETE /repos/CodeYourFuture/{name}
    GitHub-->>-Netlify: 204 No Content
    Netlify->>+Slack: POST /chat.update
    Note right of Slack: Update the post
    Slack-->>-Netlify: 200 OK
    Netlify->>+Slack: POST /reactions.add
    Note right of Slack: React to the post
    Slack-->>-Netlify: 200 OK
    Netlify->>+Slack: POST /chat.postMessage
    Note right of Slack: Respond to the post
    Slack-->>-Netlify: 200 OK
    Netlify-->>-Slack: 200 OK
    else Dismiss the message
    Admin->>Slack: Click "Dismiss"
    Slack->>+Netlify: POST /slack_interaction
    Netlify->>+Slack: POST /chat.update
    Note right of Slack: Update the post
    Slack-->>-Netlify: 200 OK
    Netlify->>+Slack: POST /reactions.add
    Note right of Slack: React to the post
    Slack-->>-Netlify: 200 OK
    Netlify->>+Slack: POST /chat.postMessage
    Note right of Slack: Respond to the post
    Slack-->>-Netlify: 200 OK
    Netlify-->>-Slack: 200 OK
    end
Loading

Configuration

The Netlify functions require the following environment variables:

  • GITHUB_TOKEN: Token used to delete repos in GitHub, a fine-grained token:
    • Resource owner should be CodeYourFuture
    • Repository access should be "All repositories"
    • Repository permissions should be:
      • Administration: read and write (to allow repository deletion)
      • Metadata: read (this is set by default)
  • GITHUB_WEBHOOK_SECRET: Secret used to verify webhook calls from GitHub
  • SLACK_CHANNEL: The channel to post messages in (currently #cyf-github-owners)
  • SLACK_SIGNING_SECRET: Secret used to verify webhook calls from Slack
  • SLACK_TOKEN: Token used to post messages to Slack (with scopes chat:write and reactions:write)

About

Integrating GitHub and Slack via Netlify

Resources

Readme
ISC license

Code of conduct

Code of conduct

Security policy

Security policy
Activity
Custom properties

Stars

1 star

Watchers

1 watching

Forks

1 fork
Report repository

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.