Skip to content

Commit

Permalink
feat: outputs and release please (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
oycyc authored Aug 19, 2024
1 parent 6236e8b commit 1be1316
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Create Release via Google Release Please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # 4.1.3
with:
release-type: simple
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ In the example below, all `_test.rego` files' location are valid and will be exe
| `report_untested_files` | Check & report Rego files without corresponding test files | No | `false` |
| `opa_version` | Version of the OPA CLI to use. | No | `0.67.1` |

### Outputs
<!-- write outputs like the above, for these outputs:
parsed_results:
description: 'The parsed results after processing the tests and/or coverage report.'
value: ${{ steps.parse-results.outputs.parsed_results }}
tests_failed:
description: 'A `true` or `false` flag indicating if any of the tests failed or not.'
value: ${{ steps.parse-results.outputs.tests_failed }} -->
| Output | Description
|--------|------------
| `parsed_results` | The parsed results after processing the tests and/or coverage report.
| `tests_failed` | A `true` or `false` flag indicating if any of the tests failed or not.

## ⚙️ How It Works
This GitHub Action automates the process of testing OPA (Open Policy Agent) Rego policies and generating coverage reports. Here's a breakdown of its operation:

Expand Down Expand Up @@ -140,6 +153,4 @@ Contributions are welcome! Please feel free to submit a Pull Request or open any
- right now, it just exits code 2. not helpful and someone new to sys wouldn't know where to look at.
- one way is to PR comment error occured in the execution of the tests. please tak eal ook at the logs..
- publish to marketplace
- release please.
- clean up bash script. optimization.
- add outputs
10 changes: 7 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ inputs:
description: 'Version of OPA CLI to use. Default is 0.67.1.'
required: false
default: '0.67.1'
outputs:
parsed_results:
description: 'The parsed results after processing the tests and/or coverage report.'
value: ${{ steps.parse-results.outputs.parsed_results }}
tests_failed:
description: 'A `true` or `false` flag indicating if any of the tests failed or not.'
value: ${{ steps.parse-results.outputs.tests_failed }}

runs:
using: 'composite'
Expand Down Expand Up @@ -131,9 +138,6 @@ runs:
id: parse-results
run: node ${{ github.action_path }}/dist/index.js
shell: bash
# We need to use `env` to pass the inputs into the script. Since this isn't running `with: node` (find the specifics)
# we cannot pass it in with 'inputs' in this workflow step with this composite action.
# GitHub Actions doesn't have a direct way of having a composite action use a custom action within the same repository.
env:
test_result: ${{ steps.opa-test.outputs.test_result }}
coverage_result: ${{ steps.opa-coverage.outputs.coverage_result }}
Expand Down

0 comments on commit 1be1316

Please sign in to comment.