Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implemented Pizza GitHub action #1

Merged
merged 11 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For more information about the pizza-cli. check out the OpenSauced [pizza-cli](h
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.

```yaml
name: Runs the OpenSauced Pizza CLI
name: OpenSauced Pizza Action

on:
schedule:
Expand All @@ -20,14 +20,14 @@ on:
workflow_dispatch: # Allow manual triggering

jobs:
update-dev-card:
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
pizza-action:
runs-on: ubuntu-latest
steps:
- name: Pizza Action
uses: open-sauced/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
command: "generate codeowners ./"
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
# optional and false by default
commit-and-push: "true"
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
```

We suggest you add this to a workflow file in the `.github/workflows` directory of your repository and call it something like `pizza-action.yml`.
Expand Down
49 changes: 32 additions & 17 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,52 @@ branding:
icon: "image"
color: "orange"
inputs:
github-token:
description: "GitHub token"
required: true
pizza-args:
description: "OpenSauced Pizza CLI command to run"
default: "generate codeowners ./"
required: true
commit-and-push:
description: "Commit and push changes"
default: "false"
required: false

runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
node-version: "20"
go-version: "1.22.5"

- name: Install pizza CLI
run: |
go install github.com/open-sauced/pizza-cli@beta
shell: bash

- name: Install dependencies
run: npm ci
- name: Check pizza CLI version
run: pizza-cli version
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
working-directory: ${{ github.action_path }}

- name: Install pizza-cli
run: go install github.com/open-sauced/pizza-cli@latest
- name: Run pizza CLI command
run: |
pwd
ls -la
pizza-cli ${{ inputs.pizza-args }}
shell: bash
working-directory: ${{ github.action_path }}
working-directory: ${{ github.workspace }}

- name: Run action
run: node ${{ github.action_path }}/index.js
- name: Commit and push changes
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ inputs.commit-and-push == 'true' }}
run: |
git config user.name github-actions
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
git config user.email [email protected]
git add .
git commit -m "Auto-commit from GitHub Actions"
git push
shell: bash
working-directory: ${{ github.action_path }}
env:
INPUT_GITHUB-TOKEN: ${{ inputs.github-token }}
working-directory: ${{ github.workspace }}
72 changes: 0 additions & 72 deletions index.js

This file was deleted.

Loading