{"id":15714365,"url":"https://github.com/krauters/github-notifier","last_synced_at":"2025-04-14T19:11:18.213Z","repository":{"id":249424024,"uuid":"817096975","full_name":"krauters/github-notifier","owner":"krauters","description":"Rich GitHub pull request notifications posted to Slack. ","archived":false,"fork":false,"pushed_at":"2025-03-25T17:20:50.000Z","size":2457,"stargazers_count":5,"open_issues_count":17,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T17:48:22.603Z","etag":null,"topics":["chatops","devops","github-notifications","github-notifier","notifications","pull-request-automation","pull-requests","slack","slack-api"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@krauters/github-notifier","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krauters.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-19T02:41:33.000Z","updated_at":"2024-11-26T14:53:56.000Z","dependencies_parsed_at":"2024-09-09T18:25:17.789Z","dependency_job_id":"fa04d9b1-9f04-4ff9-b3cc-76fe1f27668b","html_url":"https://github.com/krauters/github-notifier","commit_stats":null,"previous_names":["krauters/github-notifier"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krauters%2Fgithub-notifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krauters%2Fgithub-notifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krauters%2Fgithub-notifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krauters%2Fgithub-notifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krauters","download_url":"https://codeload.github.com/krauters/github-notifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248943456,"owners_count":21186958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatops","devops","github-notifications","github-notifier","notifications","pull-request-automation","pull-requests","slack","slack-api"],"created_at":"2024-10-03T21:36:22.235Z","updated_at":"2025-04-14T19:11:18.191Z","avatar_url":"https://github.com/krauters.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/coltenkrauter","https://img.buymeacoffee.com/button-api/?text=Buy"],"categories":[],"sub_categories":[],"readme":"\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://www.linkedin.com/in/coltenkrauter/\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/LinkedIn-%230077B5.svg?\u0026style=flat-square\u0026logo=linkedin\u0026logoColor=white\" alt=\"LinkedIn\"\u003e\u003c/a\u003e\n![GitHub Action Status](https://github.com/krauters/github-notifier/workflows/Tests/badge.svg)\n[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-GitHub%20Notifier-blue)](https://github.com/marketplace/actions/github-notifier-by-krauters)\n![License](https://img.shields.io/github/license/krauters/github-notifier)\n![visitors](https://visitor-badge.laobi.icu/badge?page_id=krauters.github-notifier)\n\n![Version](https://img.shields.io/github/v/release/krauters/github-notifier)\n[![npm version](https://img.shields.io/npm/v/@krauters/github-notifier.svg?style=flat-square)](https://www.npmjs.org/package/@krauters/github-notifier)\n![GitHub Stars](https://img.shields.io/github/stars/krauters/github-notifier)\n![Forks](https://img.shields.io/github/forks/krauters/github-notifier)\n\n![GitHub Issues](https://img.shields.io/github/issues/krauters/github-notifier)\n![Open PRs](https://img.shields.io/github/issues-pr/krauters/github-notifier)\n![Commits per Month](https://img.shields.io/github/commit-activity/m/krauters/github-notifier)\n![Contributors](https://img.shields.io/github/contributors/krauters/github-notifier)\n![Last Commit](https://img.shields.io/github/last-commit/krauters/github-notifier)\n\n[![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=@krauters/github-notifier\u0026query=$.install.pretty\u0026label=install%20size\u0026style=flat-square)](https://packagephobia.now.sh/result?p=@krauters/github-notifier)\n![Code Size](https://img.shields.io/github/languages/code-size/krauters/github-notifier)\n![Repo Size](https://img.shields.io/github/repo-size/krauters/github-notifier)\n\n\u003c/div\u003e\n\n# GitHub Notifier\n\nPost Open Pull Requests to Slack.\n\n![GitHub Notifier Example](./images/example.png)\n\n[Simple Usage Example](https://github.com/krauters/github-slack-notifier)\n\n**GitHub Notifier** is a _TypeScript_ [GitHub Action](https://docs.github.com/en/actions) that posts open pull requests to Slack channels based on a [scheduled job](https://crontab.guru/) to remind team members to review pull requests.\n\n## Overview\n\nThis _GitHub Action_ will query the GitHub (or GitHub Enterprise) org for all repositories (based on token permissions) and then, for each repository it will check for open pull requests. Then, it will attempt to match any related GitHub users to Slack users before building [Slack blocks](https://app.slack.com/block-kit-builder/T025EE5RS#%7B%22blocks%22:%5B%5D%7D) and posting a message (or multiple messages in the case of many PRs) to the designated Slack channels. \n\n## Quick start\n\n1. (Optional) Start by creating a repository called `github-notifier`.\n    1. Whatever repo you use to host this workflow needs to be able to use GitHub Runners.\n1. [Generate a GitHub token](https://github.com/settings/tokens?type=beta) – You’ll need a fine-grained GitHub token that allows access to either all your repositories or just the ones you want notifications about.\n\n    Here are the specific permissions the token needs:\n\n    - **Repository Administration: read** – This lets the token list repositories within the organization.\n    - **Repository Pull Requests: read** – Required to fetch details about pull requests.\n    - **Repository Contents: read** – Allows the token to check the status of repository branch protections.\n    - **Organization Members: read** – Required to retrieve GitHub email addresses for matching them with Slack users.\n\n    Make sure the token is created by an organization owner, as it must belong to the organization where the relevant repositories and pull requests live.\n\n\n    1. Save the token in your repository by going to `Settings` \u003e `Secrets and variables` \u003e `Actions` \u003e `New repository secret`, and name it **GH_TOKEN_GH_NOTIFIER**.\n\n1. [Create a Slack App](https://api.slack.com/apps) either _from scratch_ or by using a pre-defined [manifest file](./manafest.json).\n\n    - To create from scratch: Start a new app called `GitHub Notifier` and add it to your Slack workspace.\n    - To use the manifest: On the Slack App creation page, select \"From an app manifest\" and upload your `manifest.json` file to quickly set up the app.\n\n    1. On the **OAuth \u0026 Permissions** page, assign the following scopes to the bot,\n\n        - **chat:write** – So the bot can post messages in Slack channels.\n        - **users:read** – To look up Slack users for matching with GitHub accounts.\n        - **users:read.email** – Allows the bot to retrieve Slack user emails for matching with GitHub accounts.\n        - **chat:write.customize** – This enables the bot to modify its display name and avatar when posting.\n\n    1. On the **OAuth \u0026 Permissions** page, click `Install To Workspace`, then copy the `User OAuth Token`.\n    1. Save this token in your repository at `Settings` \u003e `Secrets and variables` \u003e `Actions` \u003e `New repository secret`, naming it **SLACK_TOKEN_GH_NOTIFIER**.\n    1. Add the Slack app you just created to the relevant Slack channel(s) and note down the channel IDs for the workflow.\n\n1. Set up a workflow similar to this:\n    ```yaml\n    # .github/workflows/github-notifier.yaml\n\n    name: GitHub Notifier\n\n    on:\n      schedule:\n      - cron: 0 15,17,19,21,23 * * 1-5\n      workflow_dispatch:\n\n    jobs:\n      github-notifier:\n        runs-on: ubuntu-latest\n        steps:\n        - uses: krauters/github-notifier@main\n          with:\n            github-token: ${{ secrets.GH_TOKEN_GH_NOTIFIER }}\n            channels: C07L8EWB389\n            slack-token: ${{ secrets.SLACK_TOKEN_GH_NOTIFIER }}\n    ```\n    \n    For more details about available inputs, you can check out the [action definition file, action.yaml](./action.yaml).\n\n## Input Variables\n\nSee [action.yaml](./action.yaml) for more detailed information.\n\n| Name                  | Description                                                                                 | Required | Default  |\n|-----------------------|---------------------------------------------------------------------------------------------|----------|----------|\n| `github-token`        | Fine-grained GitHub token with necessary scopes for administration, PR details, and members.| Yes      |          |\n| `slack-token`         | Permissions to post to Slack and perform user lookups.                                       | Yes      |          |\n| `channels`            | Comma-separated list of Slack channel IDs to post to.                                        | Yes      |          |\n| `with-archived`       | Include PRs from archived repositories.                                                      | No       | `false`  |\n| `with-public`         | Include PRs from public repositories.                                                        | No       | `true`   |\n| `with-drafts`         | Include draft PRs.                                                                           | No       | `false`  |                   | No       | `false`  |\n| `with-user-mentions`  | Allow Slack user mentions.                                                                   | No       | `true`   |\n| `repository-filter`   | Comma-separated list of repositories to scan.                                                | No       |          |\n| `base-url`            | Base GitHub API URL (e.g., https://api.github.com).                                          | No       |          |\n\n## Troubleshooting\n\n```\nError: An API error occurred: channel_not_found\n```\n\n\nThis error means the Slack app probably wasn’t added to the channel you’re trying to post in.\n\n## Husky\n\nHusky helps manage Git hooks easily, automating things like running tests or linting before a commit is made. This ensures your code is in good shape.\n\nPre-commit hooks run scripts before a commit is finalized to catch issues or enforce standards. With Husky, setting up these hooks across your team becomes easy, keeping your codebase clean and consistent.\n\n### Our Custom Pre-Commit Hook\n\nThis project uses a custom pre-commit hook to run `npm run bundle`. This ensures that our bundled assets are always up to date before any commit (which is especially important for TypeScript GitHub Actions). Husky automates this, so no commits will go through without a fresh bundle, keeping everything streamlined.\n\n## Contributing\n\nThe goal of this project is to continually evolve and improve its core features, making it more efficient and easier to use. Development happens openly here on GitHub, and we’re thankful to the community for contributing bug fixes, enhancements, and fresh ideas. Whether you're fixing a small bug or suggesting a major improvement, your input is invaluable.\n\n## License\n\nThis project is licensed under the ISC License. Please see the [LICENSE](./LICENSE) file for more details.\n\n## 🥂 Thanks Contributors\n\nThanks for spending time on this project.\n\n\u003ca href=\"https://github.com/krauters/github-notifier/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=krauters/github-notifier\" /\u003e\n\u003c/a\u003e\n\n## References to this project\n\n- [Stack Overflow / Customizing slack notification for Github pull requests](https://stackoverflow.com/questions/66948900/customizing-slack-notification-for-github-pull-requests/78949579#78949579)\n\n- [Reddit / Recommended slack app to post github pull requests notifications?](https://www.reddit.com/r/Slack/comments/1e3pdfr/comment/llhfu11/?utm_source=share\u0026utm_medium=web3x\u0026utm_name=web3xcss\u0026utm_term=1\u0026utm_content=share_button)\n\n- [GitHub Discussions / Best way to send slack to developers notifications daily about new PRs, new issues or new comments?](https://github.com/orgs/community/discussions/70288)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\u003ca href=\"https://www.buymeacoffee.com/coltenkrauter\"\u003e\u003cimg src=\"https://img.buymeacoffee.com/button-api/?text=Buy me a coffee\u0026emoji=\u0026slug=coltenkrauter\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Cookie\u0026outline_colour=000000\u0026coffee_colour=ffffff\" /\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrauters%2Fgithub-notifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrauters%2Fgithub-notifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrauters%2Fgithub-notifier/lists"}