Skip to content
 
 

Repository files navigation

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!

These docs describe main. Features added since the latest release (v2.0.0) ship in the next release, which also creates the floating v2 tag; until then pin @v2.0.0 for the released behaviour. The action requires the node24 runtime (GitHub requires actions/runner 2.327.1 or newer for node24 on self-hosted runners) and works on GitHub Enterprise Server via GITHUB_API_URL.


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

name: Prow github actions
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@v2
        with:
          prow-commands: /assign /unassign /cc /uncc /approve /lgtm /hold /close /reopen /lock /retitle /milestone /remove /area /kind /priority /label /lifecycle /stage /status /help /good-first-issue /meow
          github-token: '${{ secrets.GITHUB_TOKEN }}'

This is the full list of available commands. Prow-style aliases (/unhold, /remove-kind, ...) come with their base command, and listing an alias enables the whole command family.

Configuration can live in the repo or in your org's .project/.github repo — see configuration.

Label commands only apply labels the repository already has. Create them from the configuration with the label-sync job, on demand or whenever prow.yaml changes:

name: Sync labels from prow.yaml
on:
  workflow_dispatch:
  push:
    branches: [main]
    paths: [.github/prow.yaml]

permissions:
  contents: read
  issues: write

jobs:
  execute:
    runs-on: ubuntu-latest
    steps:
      - uses: cncf/prow-github-actions@v2
        with:
          jobs: label-sync
          github-token: '${{ secrets.GITHUB_TOKEN }}'

PRs merge automatically once they carry lgtm, no do-not-merge/*, needs-rebase or hold label, and GitHub reports them mergeable. Subscribe to the events that change that (automatic merging); the merge needs contents: write:

name: Merge on lgtm
on:
  pull_request:
    types: [opened, reopened, synchronize, ready_for_review, labeled, unlabeled]
  pull_request_review:
    types: [submitted, dismissed]
  check_suite:
    types: [completed]

permissions:
  contents: write
  pull-requests: write

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

          # optional; defaults to 'merge', tide.merge_method in prow.yaml wins
          merge-method: squash

An optional schedule workflow with jobs: lgtm is the backstop for missed events (jobs).

Prow Github actions also supports removing the lgtm label when new commits are pushed to a PR (the synchronize activity type; other types are skipped)

name: Run Jobs on PR
on: pull_request

permissions:
  pull-requests: write

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

Documentation


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

About

Slash commands, jobs, and chat-ops for Github actions inspired by Kubernetes Prow ⚓️

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages