Home

Awesome

Prow Github Actions ⛵️

This project is inspired by Prow and brings its chat-ops functionality and project management to a simple, Github actions workflow.

Prow is a Kubernetes based CI/CD system ... and provides GitHub automation in the form of policy enforcement, chat-ops via /foo style commands, and automatic PR merging.

Quickstart

Check out the "EXAMPLE" issues and pull requests (open and closed) in this repo to see how this works!


Run specified actions or jobs for issue and PR comments through a workflow.yaml file:

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 }}"

Automatically label PRs with the Github actions/labeler based on globs from .github/labels.yml:

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 }}"

Your .github/labels.yaml may look like:

# labels to be used with /area command
area:
  - 'bug'
  - 'important'

# File globs for PR labeler
tests:
  - '**/*.test.ts'

You can automatically merge PRs based on a cron schedule if it contains the lgtm label:

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 }}"

          # this is optional and defaults to 'merge'
          merge-method: 'squash'

Prow Github actions also supports removing the lgtm label when a PR is updated

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 }}"

Documentation


open water breeze
the ocean seas are endless
forward to the prow