Introducing the OpenSauced Pizza GitHub Action: Automate Your Repository Management

Introducing the OpenSauced Pizza GitHub Action: Automate Your Repository Management

3 minute read

Are you looking for an easy way to streamline your repository management tasks? Look no further! We're excited to introduce the OpenSauced Pizza GitHub Action, a powerful tool that brings the functionality of the OpenSauced Pizza CLI directly into your GitHub workflows.

Curious what the Pizza CLI is? 👇

What is the OpenSauced Pizza GitHub Action? permalink

The OpenSauced Pizza GitHub Action is a custom GitHub Action that allows you to run various commands from the OpenSauced Pizza CLI as part of your automated workflows.

The https://github.com/open-sauced/pizza-action repository on GitHubOpenGraph image for https://github.com/open-sauced/pizza-action

This action makes it simple to integrate repository management tasks into your continuous integration and deployment processes.

Key Features permalink

  1. Easy Integration: Add the action to your workflow with just a few lines of YAML.
  2. Flexible Command Execution: Run any Pizza CLI command within your GitHub Actions workflow.
  3. Automatic Updates: Schedule regular updates to keep your repository management tasks current.
  4. Optional Commit and Pull Request: Automatically commit changes and create a pull request for the updates made by the Pizza CLI.

Getting Started permalink

To use the OpenSauced Pizza GitHub Action, add the following to your GitHub Actions workflow file:


name: OpenSauced Pizza Action

on:
  schedule:
    # Run once a week on Sunday at 00:00 UTC
    - cron: "0 0 * * 0"
  workflow_dispatch: # Allow manual triggering

jobs:
  pizza-action:
    runs-on: ubuntu-latest
    steps:
      - name: Pizza Action
        uses: open-sauced/pizza-action@latest
        with:
          # optional and default is "latest". Add this parameter if you want to use a specific version, e.g. v2.0.0
          cli-version: "v2.2.0"
          # optional and false by default. Set this to true if you want to have a pull request for the changes created automatically.
          commit-and-pr: "true"
          # optional
          pr-title: "chore: update repository codeowners"

We recommend saving this as pizza-action.yml in the .github/workflows directory of your repository.

This example sets up a weekly run of the Pizza CLI's generate codeowners ./ --tty-disable command, which updates your repository's CODEOWNERS file based on contribution history.

Customization Options permalink

The action provides several inputs for customization:

  1. cli-version: The version of the pizza CLI to use. Default is latest. If using a numbered version, make sure to prefix the version number with v. For example, v2.0.0.
  2. pizza-args: Specify the Pizza CLI command to run (default: generate codeowners ./ --tty-disable).
  3. commit-and-pr: Choose whether to automatically commit changes and create a pull request (default: false).
  4. pr-title: Set a custom title for the pull request (default: chore (automated): OpenSauced updates).

Important Note permalink

The pizza CLI's "generate codeowners" command requires a full repository history to accurately determine code ownership over time. The action sets fetch-depth to 0 to ensure all historical commits are available, allowing for a comprehensive analysis of the project timeline.

Troubleshooting permalink

If you encounter the error pull request create failed: GraphQL: GitHub Actions is not permitted to create or approve pull requests (createPullRequest), you need to enable the appropriate permissions. Go to your repository settings, navigate to the Actions section, and check the option "Allow GitHub Actions to create and approve pull requests".

Here’s an example of a recent pull request that was generated by the pizza-action:

The https://github.com/open-sauced/app/pull/4103 repository on GitHubOpenGraph image for https://github.com/open-sauced/app/pull/4103

See it in action!

Future Enhancements permalink

While the current version of the Pizza CLI focuses on generating CODEOWNERS files, the OpenSauced team is actively working on expanding its capabilities. In the future, you can expect a wider range of commands to be available, further enhancing your repository management toolkit. Stay tuned for updates!

Conclusion permalink

Bottom line: the OpenSauced Pizza GitHub Action is your ticket to bringing Pizza CLI goodness straight into your GitHub workflow. It's dead simple to set up and takes care of the grunt work. Whether you're managing CODEOWNERS files or leveraging future Pizza CLI features, the Pizza GitHub Action has you covered.

Image description

Give it a try and let me know what you think!

Stay saucy peeps!

If you would like to know more about my work in open source, follow me on OpenSauced.