Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
tag

GitHub Action

Team Label Action

v1.0.1

Team Label Action

tag

Team Label Action

Add a team label based on the author's teams in the organization

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Team Label Action

uses: equitybee/[email protected]

Learn more about this action in equitybee/team-label-action

Choose a version

Auto-label PRs based on teams 🏷👥

Use this Github action to automatically add a label to PRs based on the teams the PR author belongs to.

Why did we build this?

At EquityBee, we use a large monorepo where multiple teams/squads collaborate. Due to Github's PR filtering limitations, we built this action to easily filter PRs based on the author's team membership.

For the action to work, the author must be a member of a team on Github.

How to use

Under .github/workflows create a new .yml file to run the action on every PR:

name: Assign PR team labels
on:
  pull_request:
    branches:
      - main

jobs:
  team-labels:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: equitybee/team-label-action@main
        with:
          repo-token: ${{ secrets.TOKEN }}
          organization-name: YOUR_ORGANIZATION_NAME

Make sure to add the relevant inputs:

  • repo-token is your ${{ secrets.GITHUB_TOKEN }}. You may encounter an error where this token does not have the necessary permissions to access an organization or teams. At EquityBee, we use PATs (Personal Access Token) instead. Create a personal access token with the repo or public_repo scopes enabled, and add the token as an encrypted secret for the repository or organization
  • organization-name is the name/slug of your Github organization (it comes right after https://github.com/)

Internal use

You may wonder why Husky is running a pre-commit script: we are copying its contents directly in our monorepo. Husky makes sure the dist/ directory always contains the latest, built action.

Next steps

  • add tests

License

Apache-2 © EquityBee