Skip to content

Latest commit

 

History

History
162 lines (138 loc) · 3.09 KB

examples.md

File metadata and controls

162 lines (138 loc) · 3.09 KB

Examples

.github/labels.yaml

A .github/labels.yaml file is necessary for most of the labeling commands & jobs

area:
  - 'bug'
  - 'important'

kind:
  - 'failing-test'
  - 'cleanup'

priority:
  - 'low'
  - 'mid'
  - 'high'

# File globs for PR labeler
# refer to github actions/labeler for further documentation
tests:
  - '**/*.test.ts'

source:
  - 'src/**'

Review and Approve Pull Requests

Below is an example of how to use an OWNERS file with the Prow action.

Add an OWNERS file to the root of the repository in the default branch.

# List of usernames who may use /lgtm
reviewers:
- user1
- user2
- user3

# List of usernames who may use /approve
approvers:
- user1
- user2
- admin1

Grant the default GITHUB_TOKEN permission to label issues and review pull requests.

name: "Handle prow slash commands"
on:
  issue_comment:
    types: [created]

# Grant additional permissions to the GITHUB_TOKEN
permissions:
  # Allow labeling issues
  issues: write
  # Allow adding a review to a pull request
  pull-requests: write

jobs:
  execute:
    runs-on: ubuntu-latest
    steps:
      - uses: jpmcb/prow-github-actions@v1
        with:
          prow-commands: |
            /approve
            /lgtm
          github-token: "${{ secrets.GITHUB_TOKEN }}"

All prow github actions

name: "Prow github actions"
on:
  issue_comment:
    types: [created]

jobs:
  execute:
    runs-on: ubuntu-latest
    steps:
      - uses: jpmcb/prow-github-actions@v1
        with:
          prow-commands: |
            /assign
            /unassign
            /approve
            /retitle
            /area
            /kind
            /priority
            /remove
            /lgtm
            /close
            /reopen
            /lock
            /milestone
            /hold
            /cc
            /uncc
          github-token: "${{ secrets.GITHUB_TOKEN }}"

PR Labeler

Use the Github actions/labeler which now supports pull_request_target

name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/labeler@main
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

Automatic PR merger

name: "Merge on lgtm label"
on:
  schedule:
  - cron: "0 * * * *"

jobs:
  execute:
    runs-on: ubuntu-latest
    steps:
      - uses: jpmcb/prow-github-actions@v1
        with:
          jobs: 'lgtm'
          github-token: "${{ secrets.GITHUB_TOKEN }}"

PR job to remove lgtm label on update

name: "Run Jobs on PR"
on: pull_request

jobs:
  execute:
    runs-on: ubuntu-latest
    steps:
      - uses: jpmcb/prow-github-actions@v1
        with:
          jobs: 'lgtm'
          github-token: "${{ secrets.GITHUB_TOKEN }}"