The workflows below use the action directly, one feature at a time. To install everything with
one file use the reusable workflow instead (installing); the prow.yaml
examples apply either way.
prow.yaml- Review and approve pull requests
- All prow github actions
- A dynamic label command
/meow- PR Labeler
- Automatic PR merger
- PR job to remove lgtm label on update
A configuration file is necessary for most of the labeling commands & jobs. It can live in
the repository as .github/prow.yaml (or the legacy .prowlabels.yaml) or in the
organization's .project/.github repository; see configuration:
labels:
area:
- bug
- important
kind:
- failing-test
- cleanup
priority:
- low
- mid
- high
# plain labels applied verbatim by /label
labels:
- documentation
- question
# mapping form: a later /triage replaces any existing triage/* label
triage:
values:
- accepted
- needs-information
exclusive: trueBelow is an example of how to use OWNERS files 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
- admin1Optionally add more OWNERS files in subdirectories, for example sdk/OWNERS. Their approvers and reviewers apply to files under sdk/ in addition to the root ones, unless no_parent_owners is set.
# sdk/OWNERS: sdk-maintainer may /approve and /lgtm changes under sdk/
approvers:
- sdk-maintainer
reviewers:
- sdk-reviewerA pull request that changes files under sdk/ and elsewhere is approved once the approvers who commented /approve (the author counts for the files they own) collectively cover every changed file: sdk-maintainer covers sdk/, user1 or admin1 cover everything since the root inherits downwards. The approve plugin adds the approved label at that point and keeps an [APPROVALNOTIFIER] comment up to date; /lgtm needs a reviewer or approver of at least one changed file. OWNERS files are read from the base branch of the pull request. With OWNERS files present the merge gate requires lgtm and approved (automatic merging).
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
# Allow /lgtm to record the reviewed commit as a prow/lgtm commit status
statuses: write
# Allow reading the repository
contents: read
jobs:
execute:
runs-on: ubuntu-latest
steps:
- uses: cncf/prow-github-actions@v3
with:
prow-commands: /approve /lgtm
github-token: '${{ secrets.GITHUB_TOKEN }}'The full list of available commands is kept in the README quickstart. Aliases (/unhold, /remove-kind, ...) come with their base command. One short example:
name: Prow github actions
on:
issue_comment:
types: [created]
permissions:
issues: write
pull-requests: write
statuses: write
actions: write
contents: read
jobs:
execute:
runs-on: ubuntu-latest
steps:
- uses: cncf/prow-github-actions@v3
with:
prow-commands: /assign /approve /retitle /area /kind /priority /lgtm /close /reopen /hold /cc /uncc /retest /test /ok-to-test
github-token: '${{ secrets.GITHUB_TOKEN }}'Any label section of the prow configuration becomes a /<key> command once listed in prow-commands:
name: Triage commands
on:
issue_comment:
types: [created]
permissions:
issues: write
pull-requests: write
contents: read
jobs:
execute:
runs-on: ubuntu-latest
steps:
- uses: cncf/prow-github-actions@v3
with:
prow-commands: /triage
github-token: '${{ secrets.GITHUB_TOKEN }}'With the triage section of the prow.yaml above, /triage accepted labels the issue or PR with triage/accepted.
/meow replies with a random cat image. It is opt in and calls a third party provider; see Enabling /meow.
name: Meow
on:
issue_comment:
types: [created]
permissions:
issues: write
pull-requests: write
jobs:
execute:
runs-on: ubuntu-latest
steps:
- uses: cncf/prow-github-actions@v3
with:
prow-commands: /meow
github-token: '${{ secrets.GITHUB_TOKEN }}'
# this is optional; provide it from a repository secret
cat-api-key: '${{ secrets.CAT_API_KEY }}'Use the Github actions/labeler which now supports pull_request_target
name: Pull Request Labeler
on:
- pull_request_target
permissions:
contents: read
pull-requests: write
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'See automatic PR merging for the full workflow.
See PR jobs for the full workflow.