Add option output_action (#178)

This commit is contained in:
Simon Lecoq
2021-03-08 23:38:40 +01:00
committed by GitHub
parent 64fe0c8ef0
commit e0bfbf62fd
5 changed files with 145 additions and 29 deletions

View File

@@ -102,6 +102,38 @@ Specify a single value to apply it to both height and with, and two values to us
config_padding: 6%, 10% # 6% width padding, 10% height padding
```
### 🧶 Using commits, pull requests or manual review to handle metrics output
It is possible to configure output behaviour using `output_action` option, which can be set to:
- `none`, where output will be generated in `/rendered/${filename}` without being pushed
- You can then manually post-process it
- `commit` (default), where output will directly be committed and pushed to `committer_branch`
- `pull-request`, where output will be committed to a new branch with current run id waiting for to be merged in `committer_branch`
- By appending either `-merge`, `-squash` or `-rebase`, pull request will be automatically merged with given method
- This method is useful to combine all editions of a single run with multiples metrics steps into a single commit on targetted branch
- If you choose to manually merge pull requests, be sure to disable `push:` triggers on your workflow, as it'll count as your own commit
#### Examples workflows
```yaml
# The following will:
# - open a pull request with "my-metrics-0.svg" as first commit
# - append "my-metrics-1.svg" as second commit
# - merge pull request (as second step is set to "pull-request-merge")
- uses: lowlighter/metrics@latest
with:
# ... other options
filename: my-metrics-0.svg
output_action: pull-request
- uses: lowlighter/metrics@latest
with:
# ... other options
filename: my-metrics-1.svg
output_action: pull-request-merge
```
### ♻️ Retrying automatically failed rendering
Rendering is subject to external factors and can fail from time to time.

View File

@@ -51,6 +51,19 @@ inputs:
type: string
default: github-metrics.svg
# Output action
output_action:
description: Output action
type: string
default: commit
values:
- none # Only generate file in "/metrics_renders"
- commit # Commit output to "committer_branch"
- pull-request # Commit output to a new branch and open a pull request to "committer_branch"
- pull-request-merge # Same as "pull-request" and additionaly merge pull request
- pull-request-squash # Same as "pull-request" and additionaly squash and merge pull request
- pull-request-rebase # Same as "pull-request" and additionaly rebase and merge pull request
# Optimize SVG image to reduce its filesize
# Some templates may not support this option
optimize:
@@ -148,11 +161,11 @@ inputs:
# Time to wait (in seconds) before each retry
retries_delay:
description: Time to wait (in seconds) before each retry
type: number
default: 300
min: 0
max: 3600
description: Time to wait (in seconds) before each retry
type: number
default: 300
min: 0
max: 3600
# ====================================================================================
# Options below are mostly used for testing
@@ -189,7 +202,8 @@ inputs:
- --halloween
- --error
# Dry-run mode (perform generation without pushing it)
# Dry-run mode (perform generation without output)
# Unlike "output_action" set to "none", output file won't be available in "/metrics_renders"
dryrun:
description: Enable dry-run
type: boolean