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?
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.
open-sauced / pizza-action
This action runs the OpenSauced pizza CLI in a GitHub Action workflow.
OpenSauced Pizza GitHub Action
This action runs the OpenSauced pizza CLI in a GitHub Action workflow.
About the Pizza CLI
For more information about the pizza-cli. check out the OpenSauced pizza-cli repository.
Usage
To use this action, you need to add the following to a GitHub Actions workflow file. The YAML snippet below uses the command to update your CODEOWNERS file in your repository, but replace it with whatever pizza-cli command you want to run.
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:
…This action makes it simple to integrate repository management tasks into your continuous integration and deployment processes.
Key Features
- Easy Integration: Add the action to your workflow with just a few lines of YAML.
- Flexible Command Execution: Run any Pizza CLI command within your GitHub Actions workflow.
- Automatic Updates: Schedule regular updates to keep your repository management tasks current.
- Optional Commit and Pull Request: Automatically commit changes and create a pull request for the updates made by the Pizza CLI.
Getting Started
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
The action provides several inputs for customization:
-
cli-version
: The version of the pizza CLI to use. Default islatest
. If using a numbered version, make sure to prefix the version number with v. For example,v2.0.0
. -
pizza-args
: Specify the Pizza CLI command to run (default:generate codeowners ./ --tty-disable
). -
commit-and-pr
: Choose whether to automatically commit changes and create a pull request (default:false
). -
pr-title
: Set a custom title for the pull request (default:chore (automated): OpenSauced updates
).
Important Note
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
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:
chore (automated): OpenSauced updates #4103
This is an automated PR generated by the OpenSauced pizza-action.
See it in action!
Future Enhancements
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
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.
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.
Top comments (2)
this project looks interesting. definitely should get a crash course in glitchub cli
Thanks for checking out the blog post! I wrote about the GitHub CLI last year.
Boost productivity with the GitHub CLI
Nick Taylor for OpenSauced ・ Nov 14 '23