Skip to content

👍 GitHub Action for labeling a GitHub pull request or an issue

License

Notifications You must be signed in to change notification settings

studroid/label-pr-or-issue-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

Label PR or Issue GitHub Action

Name: studroid/label-pr-or-issue-action

Add a label to a PR or an issue by its number.

Usage instructions

name: Label a Pull Request or an Issue
on: pull_request_target

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      issues: write
    steps:
      - uses: studroid/label-pr-or-issue-action@v1
        with:
          label: "my-label"
name: Label a Pull Request or an Issue

on:
  workflow_dispatch:
    inputs: 
      prOrIssueNumber:
        description: Pull request or issue number to label
        required: true

jobs:
  auto-approve:
    runs-on: ubuntu-latest
    permissions:
      issues: write
    steps:
    - uses: studroid/label-pr-or-issue-action@v1
      with:
        pr-or-issue-number: ${{ github.event.inputs.prOrIssueNumber }}
        label: "my-label"

Labeling on behalf of a different user

By default, this will use the automatic GitHub token that's provided to the workflow. This means the approval will come from the "github-actions" bot user. Make sure you enable the issues: write permission in your workflow.

To approve the pull request as a different user, pass a GitHub Personal Access Token into the github-token input. In order to approve the pull request, the token needs the repo scope enabled.

name: Label a Pull Request or an Issue

on: pull_request_target

jobs:
  auto-approve:
    runs-on: ubuntu-latest
    steps:
      - uses: studroid/label-pr-or-issue-action@v1
        with:
          github-token: ${{ secrets.SOME_USERS_PAT }}
          pr-or-issue-number: ${{ github.event.inputs.prOrIssueNumber }}
          label: "my-label"

Development and release process

Each major version corresponds to a branch (e.g. v2, v3). The latest major version (v1 at the time of writing) is the repository's default branch. Releases are tagged with semver-style version numbers (e.g. v1.2.3).

About

👍 GitHub Action for labeling a GitHub pull request or an issue

Resources

License

Stars

Watchers

Forks

Languages

  • TypeScript 100.0%