Team labeler action
ActionsTags
(2)This repository provides a GitHub action to automatically team label on a pull request based author team. This is useful if multiple team are working on the same project.
You need to provide a yml file that contains members of your teams:
LightSide:
- '@Yoda'
- '@Luke'
DarkSide:
- '@DarkVador'
- '@Palpatine'
You can also use GitHub team names to automatically apply labels based on team membership. To do this:
Include team names in your configuration using the format @organization/team-slug
:
FrontendTeam:
- '@YourOrg/frontend'
BackendTeam:
- '@YourOrg/backend'
Create a workflow (eg: .github/workflows/team-labeler.yml
see Creating a Workflow file) to utilize the labeler action.
This action only needs the GITHUB_TOKEN secret as it interacts with the GitHub API to modify labels. It's working for pull request and issues. The action can be used as such:
on:
pull_request:
issues:
name: team-label
permissions:
contents: read
pull-requests: write
issues: write # Necessary to create the labels if they do not exist yet.
jobs:
team-labeler:
runs-on: ubuntu-latest
steps:
- uses: JulienKode/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# Optional: Add if you want to use GitHub team-based labeling
org-token: "${{ secrets.ORG_TOKEN }}"
-
For basic functionality, the workflow needs:
contents: read
pull-requests: write
(to apply labels to pull requests)issues: write
(to apply labels to issues and create labels if they do not exist yet)
-
For GitHub team integration, you need to:
- Create a Personal Access Token with
read:org
permission - Add this token as a repository secret (e.g.,
ORG_TOKEN
) - Pass this token to the action using the
org-token
parameter
- Create a Personal Access Token with
Note: While the
issues:write
permission does allow for creating labels through GitHub's API.
Team labeler action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.