Create multiple actions to make Mako easier to use

This commit is contained in:
TSR Berry 2023-09-17 12:18:20 +02:00
parent 09cd87917d
commit c67b7c75b3
No known key found for this signature in database
GPG Key ID: 52353C0A4CCA15E2
6 changed files with 112 additions and 38 deletions

View File

@ -0,0 +1,20 @@
# execute-command
A small composite action to run the specified Mako subcommand.
## Usage
Add the following step to your workflow:
```yml
- name: Execute Ryujinx-Mako command
uses: Ryujinx/Ryujinx-Mako/.github/actions/execute-command@master
with:
command: "<a valid subcommand for Mako>"
args: "<subcommand args>"
app_id: ${{ secrets.MAKO_APP_ID }}
private_key: ${{ secrets.MAKO_PRIVATE_KEY }}
installation_id: ${{ secrets.MAKO_INSTALLATION_ID }}
```

View File

@ -0,0 +1,29 @@
name: 'Mako command'
description: 'Execute a Mako subcommand'
inputs:
command:
description: 'Subcommand to execute with Mako'
required: true
args:
description: 'Arguments for the specified subcommand'
required: true
default: ''
app_id:
description: 'GitHub App ID'
required: true
private_key:
description: 'Private key for the GitHub App'
required: true
installation_id:
description: 'GitHub App Installation ID'
required: true
runs:
using: 'composite'
steps:
- run: |
poetry -n -C "${{ github.action_path }}../" run ryujinx-mako ${{ inputs.command }} ${{ inputs.args }}
shell: bash
env:
MAKO_APP_ID: ${{ inputs.app_id }}
MAKO_PRIVATE_KEY: ${{ inputs.private_key }}
MAKO_INSTALLATION_ID: ${{ inputs.installation_id }}

View File

@ -6,18 +6,11 @@ It installs poetry and all module dependencies.
## Usage
Add the following steps to your workflow:
Add the following step to your workflow:
```yml
- name: Checkout Ryujinx-Mako
uses: actions/checkout@v3
with:
repository: Ryujinx/Ryujinx-Mako
ref: master
path: ".ryujinx-mako"
- name: Setup Ryujinx-Mako
uses: .ryujinx-mako/.github/actions/setup-mako
uses: Ryujinx/Ryujinx-Mako/.github/actions/setup-mako@master
```

View File

@ -1,5 +1,5 @@
name: 'Setup Ryujinx-Mako'
description: 'Setup the environment for Ryujinx-Mako'
name: 'Setup Mako'
description: 'Setup the environment for Mako'
runs:
using: 'composite'
steps:
@ -7,6 +7,6 @@ runs:
shell: bash
- run: |
cd .ryujinx-mako
cd "${{ github.action_path }}/../"
poetry install --only main
shell: bash

View File

@ -4,33 +4,18 @@ A custom GitHub App to aid Ryujinx with project management and moderation
## Usage
1. Add the following steps to your workflow:
Add the following step to your workflow:
```yml
- name: Checkout Ryujinx-Mako
uses: actions/checkout@v3
with:
repository: Ryujinx/Ryujinx-Mako
ref: master
path: '.ryujinx-mako'
- name: Setup Ryujinx-Mako
uses: ./.ryujinx-mako/.github/actions/setup-mako
```
2. Execute the available commands like this:
```yml
- name: Setup git identity for Ryujinx-Mako
run: |
# poetry -n -C .ryujinx-mako run ryujinx-mako <command> [<args>]
# for example:
poetry -n -C .ryujinx-mako run ryujinx-mako setup-git
env:
MAKO_APP_ID: ${{ secrets.MAKO_APP_ID }}
MAKO_PRIVATE_KEY: ${{ secrets.MAKO_PRIVATE_KEY }}
MAKO_INSTALLATION_ID: ${{ secrets.MAKO_INSTALLATION_ID }}
```
```yml
- name: Run Ryujinx-Mako
uses: Ryujinx/Ryujinx-Mako@master
with:
command: <Mako subcommand>
args: <subcommand args>
app_id: ${{ secrets.MAKO_APP_ID }}
private_key: ${{ secrets.MAKO_PRIVATE_KEY }}
installation_id: ${{ secrets.MAKO_INSTALLATION_ID }}
```
## Available commands

47
action.yml Normal file
View File

@ -0,0 +1,47 @@
name: 'Run Ryujinx-Mako'
description: 'Setup Mako and execute the specified subcommand'
inputs:
command:
description: 'Subcommand to execute with Mako'
required: true
args:
description: 'Arguments for the specified subcommand'
required: true
default: ''
app_id:
description: 'GitHub App ID'
required: true
private_key:
description: 'Private key for the GitHub App'
required: true
installation_id:
description: 'GitHub App Installation ID'
required: true
runs:
using: 'composite'
steps:
- name: Check if Mako was already setup
id: check_dest
run: |
[ -f "${{ github.action_path }}/.ryujinx-mako_setup-done" ] \
&& echo "exists=true" >> $GITHUB_OUTPUT \
|| echo "exists=false" >> $GITHUB_OUTPUT
shell: bash
- name: Setup Mako
if: steps.check_dest.outputs.exists == "false"
uses: ./.github/actions/setup-mako
- name: Create setup finished flag
if: steps.check_dest.outputs.exists == "false"
run: touch "${{ github.action_path }}/.ryujinx-mako_setup-done"
shell: bash
- name: Run Mako subcommand
uses: ./.github/actions/execute-command
with:
command: ${{ inputs.command }}
args: ${{ inputs.args }}
app_id: ${{ inputs.app_id }}
private_key: ${{ inputs.private_key }}
installation_id: ${{ inputs.installation_id }}