Skip to content

Commit 1be1316

Browse files
authored
feat: outputs and release please (#4)
1 parent 6236e8b commit 1be1316

3 files changed

Lines changed: 38 additions & 5 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Create Release via Google Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # 4.1.3
17+
with:
18+
release-type: simple

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ In the example below, all `_test.rego` files' location are valid and will be exe
8282
| `report_untested_files` | Check & report Rego files without corresponding test files | No | `false` |
8383
| `opa_version` | Version of the OPA CLI to use. | No | `0.67.1` |
8484

85+
### Outputs
86+
<!-- write outputs like the above, for these outputs:
87+
parsed_results:
88+
description: 'The parsed results after processing the tests and/or coverage report.'
89+
value: ${{ steps.parse-results.outputs.parsed_results }}
90+
tests_failed:
91+
description: 'A `true` or `false` flag indicating if any of the tests failed or not.'
92+
value: ${{ steps.parse-results.outputs.tests_failed }} -->
93+
| Output | Description
94+
|--------|------------
95+
| `parsed_results` | The parsed results after processing the tests and/or coverage report.
96+
| `tests_failed` | A `true` or `false` flag indicating if any of the tests failed or not.
97+
8598
## ⚙️ How It Works
8699
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:
87100

@@ -140,6 +153,4 @@ Contributions are welcome! Please feel free to submit a Pull Request or open any
140153
- right now, it just exits code 2. not helpful and someone new to sys wouldn't know where to look at.
141154
- one way is to PR comment error occured in the execution of the tests. please tak eal ook at the logs..
142155
- publish to marketplace
143-
- release please.
144156
- clean up bash script. optimization.
145-
- add outputs

action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ inputs:
4040
description: 'Version of OPA CLI to use. Default is 0.67.1.'
4141
required: false
4242
default: '0.67.1'
43+
outputs:
44+
parsed_results:
45+
description: 'The parsed results after processing the tests and/or coverage report.'
46+
value: ${{ steps.parse-results.outputs.parsed_results }}
47+
tests_failed:
48+
description: 'A `true` or `false` flag indicating if any of the tests failed or not.'
49+
value: ${{ steps.parse-results.outputs.tests_failed }}
4350

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

0 commit comments

Comments
 (0)