Skip to content

Commit

Permalink
add autofix_started action output, fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Oct 8, 2023
1 parent 8caa572 commit a10e2e1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ This repository contains the **autofix.ci** GitHub Action.
1. Install the [autofix.ci GitHub App](https://autofix.ci) for your repository.
2. Add this action at the end of your code-formatting CI job.
See [autofix.ci/setup](https://autofix.ci/setup) for examples!

## Customization

See [action.yml](./action.yml) for a list of all the available inputs and outputs.
You can pass inputs like this:

```yaml
- uses: autofix-ci/action@hash
with:
fail-fast: false
```
## Badge
[![autofix enabled](https://shields.io/badge/autofix.ci-yes-success?logo=data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjZmZmIiB2aWV3Qm94PSIwIDAgMTI4IDEyOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCB0cmFuc2Zvcm09InNjYWxlKDAuMDYxLC0wLjA2MSkgdHJhbnNsYXRlKC0yNTAsLTE3NTApIiBkPSJNMTMyNSAtMzQwcS0xMTUgMCAtMTY0LjUgMzIuNXQtNDkuNSAxMTQuNXEwIDMyIDUgNzAuNXQxMC41IDcyLjV0NS41IDU0djIyMHEtMzQgLTkgLTY5LjUgLTE0dC03MS41IC01cS0xMzYgMCAtMjUxLjUgNjJ0LTE5MSAxNjl0LTkyLjUgMjQxcS05MCAxMjAgLTkwIDI2NnEwIDEwOCA0OC41IDIwMC41dDEzMiAxNTUuNXQxODguNSA4MXExNSA5OSAxMDAuNSAxODAuNXQyMTcgMTMwLjV0MjgyLjUgNDlxMTM2IDAgMjU2LjUgLTQ2IHQyMDkgLTEyNy41dDEyOC41IC0xODkuNXExNDkgLTgyIDIyNyAtMjEzLjV0NzggLTI5OS41cTAgLTEzNiAtNTggLTI0NnQtMTY1LjUgLTE4NC41dC0yNTYuNS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A2NS41dC0yNSA4MS41cS04MSAtMTggLTE0NSAtNzB0LTEwMSAtMTI1LjV0LTM3IC0xNTguNXEwIC0xMDIgNDguNSAtMTgwLjV0MTI5LjUgLTEyM3QxNzkgLTQ0LjV6Ii8+PC9zdmc+)](https://autofix.ci)
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ branding:
icon: 'check-circle'
color: 'green'
runs:
using: 'node16'
using: 'node20'
main: 'index.js'
inputs:
fail-fast:
Expand All @@ -14,3 +14,8 @@ inputs:
commit-message:
description: 'The commit message to use when fixing a commit.'
required: false
outputs:
autofix_started:
description: |
Boolean indicating whether changes have been sent to the autofix server
and a fix commit is coming up.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const fs = require("fs");

async function run() {
try {
core.setOutput('autofix_started', false);

if (process.env.GITHUB_WORKFLOW !== "autofix.ci") {
throw new Error(`For security reasons, the workflow in which the autofix.ci action is used must be named "autofix.ci".`);
}
Expand Down Expand Up @@ -103,6 +105,7 @@ async function run() {
const body = await resp.readBody();
if (resp.message.statusCode === 200) {
core.setFailed("✅ Autofix task started.");
core.setOutput('autofix_started', true);
} else {
console.log(resp.message.statusCode, body);
core.setFailed(body);
Expand Down

0 comments on commit a10e2e1

Please sign in to comment.