You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ This _GitHub Action_ will query the GitHub (or GitHub Enterprise) org for all re
43
43
44
44
1. (Optional) Start by creating a repository called `github-notifier`.
45
45
1. Whatever repo you use to host this workflow needs to be able to use GitHub Runners.
46
-
1.[Generate a GitHub token](https://github.com/settings/tokens?type=beta) – You’ll need a fine-grained GitHub token with resource owner being an organization that allows access to either all your repositories or just the ones you want notifications about.
46
+
1.[Generate a GitHub token](https://github.com/settings/tokens?type=beta) – You'll need a fine-grained GitHub token with resource owner being an organization that allows access to either all your repositories or just the ones you want notifications about.
47
47
48
48
Here are the specific permissions the token needs:
49
49
@@ -93,6 +93,7 @@ This _GitHub Action_ will query the GitHub (or GitHub Enterprise) org for all re
For more details about available inputs, you can check out the [action definition file, action.yaml](./action.yaml).
@@ -106,21 +107,37 @@ See [action.yaml](./action.yaml) for more detailed information.
106
107
| `github-tokens` | Comma Comma-separated list of fine grained Github tokens (one per GitHub organization) with scopes for administration, PR details, and members.| Yes | |
107
108
| `slack-token` | Permissions to post to Slack and perform user lookups. | Yes | |
108
109
| `channels` | Comma-separated list of Slack channel IDs to post to. | Yes | |
110
+
| `user-mappings` | Comma-separated list of GitHub to Slack username mappings in the format "github:slack". Example: "octocat:slackcat,user1:slack1"| No | |
109
111
| `with-archived` | Include PRs from archived repositories. | No | `false` |
110
112
| `with-public` | Include PRs from public repositories. | No | `true` |
111
113
| `with-drafts` | Include draft PRs. | No | `false` | | No | `false` |
112
114
| `with-user-mentions` | Allow Slack user mentions. | No | `true` |
113
115
| `repository-filter` | Comma-separated list of repositories to scan. | No | |
114
116
| `base-url` | Base GitHub API URL (e.g., https://api.github.com). | No | |
115
117
118
+
## User Matching
119
+
120
+
GitHub Notifier attempts to match GitHub users with their corresponding Slack accounts to properly tag users and display avatars in notifications. The matching process works in the following order:
121
+
122
+
1. **Custom user mappings** - Define explicit GitHub to Slack username mappings using the `user-mappings` parameter (e.g., `github-user:slack-user`). This takes highest priority.
123
+
124
+
2. **Fallback matching methods** - If no mapping is found or if the mapped Slack username doesn't exist, the system automatically tries to match users by:
125
+
- User ID (if provided)
126
+
- Email address
127
+
- Username contained in email
128
+
- Display name
129
+
- Real name
130
+
131
+
This flexible matching system helps ensure that users are properly identified across both platforms, even when usernames don't match exactly.
132
+
116
133
## Troubleshooting
117
134
118
135
```
119
136
Error: An API error occurred: channel_not_found
120
137
```
121
138
122
139
123
-
This error means the Slack app probably wasn’t added to the channel you’re trying to post in.
140
+
This error means the Slack app probably wasn't added to the channel you're trying to post in.
124
141
125
142
## Husky
126
143
@@ -134,7 +151,7 @@ This project uses a custom pre-commit hook to run `npm run bundle`. This ensures
134
151
135
152
## Contributing
136
153
137
-
The 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.
154
+
The 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.
0 commit comments