Skip to content

Commit 83dd668

Browse files
Docs: add examples and update readme
1 parent d339aa5 commit 83dd668

File tree

4 files changed

+71
-10
lines changed

4 files changed

+71
-10
lines changed

README.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ We recommend storing these in GitHub secrets. You can find instructions on how t
1717
In any workflow for PRs, add the following step:
1818

1919
```yaml
20-
- name: Docs Assertion Tester
21-
uses: hasura/docs-assertion-tester@v1
22-
with:
23-
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
24-
github_token: ${{ secrets.GITHUB_TOKEN }}
25-
org: ${{ github.repository_owner }}
26-
repo: ${{ github.repository }}
27-
pr_number: ${{ github.event.number }}
20+
- name: Docs Assertion Tester
21+
id: docs_test
22+
uses: hasura/[email protected]
23+
with:
24+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
25+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
26+
GITHUB_ORG: ${{ github.repository_owner }}
27+
GITHUB_REPOSITORY: ${{ github.repository }}
28+
PR_NUMBER: ${{ github.event.number }}
2829
```
2930
3031
## Usage
@@ -56,8 +57,8 @@ scope will check the assertions against the entire set of files changed, includi
5657
Upon completion, the assertion tester will output the analysis in markdown format. You can add a comment to your PR
5758
using our handy [GitHub Action](https://github.com/marketplace/actions/comment-progress).
5859

59-
Using our `comment-progress` action, the output looks like this after running [the sample workflow](#) in the `/samples`
60-
folder:
60+
Using our `comment-progress` action, the output looks like this after running
61+
[the sample workflow](/sample/analyze-and-post.yaml) in the `/sample` folder:
6162

6263
<!-- TODO: Add screenshot -->
6364

sample/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Sample Workflows
2+
3+
This directory contains sample workflows that can be used as a starting point for your own workflows.
4+
5+
Currently, there are two sample workflows:
6+
7+
- [`analyze.yaml`](./analyze.yaml)
8+
- [`analyze-and-post.yaml`](./analyze-and-post.yaml)

sample/analyze-and-post.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This assumes you've added secrets to your repository with the names OPENAI_API_KEY and TOKEN (for your GitHub token)
2+
3+
name: Test DX assertions
4+
5+
on:
6+
pull_request:
7+
types: [opened, synchronize]
8+
9+
jobs:
10+
test-dx-assertions:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Docs Assertion Tester
15+
id: docs_test
16+
uses: hasura/[email protected]
17+
with:
18+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
19+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
20+
GITHUB_ORG: ${{ github.repository_owner }}
21+
GITHUB_REPOSITORY: ${{ github.repository }}
22+
PR_NUMBER: ${{ github.event.number }}
23+
- name: Add comment
24+
uses: hasura/[email protected]
25+
with:
26+
github-token: ${{secrets.TOKEN}}
27+
repository: ${{ github.repository }}
28+
number: ${{ github.event.number }}
29+
id: dx_analysis
30+
message: ${{ steps.docs_test.outputs.analysis }}

sample/analyze.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This assumes you've added secrets to your repository with the names OPENAI_API_KEY and TOKEN (for your GitHub token)
2+
3+
name: Test DX assertions
4+
5+
on:
6+
pull_request:
7+
types: [opened, synchronize]
8+
9+
jobs:
10+
test-dx-assertions:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Docs Assertion Tester
15+
id: docs_test
16+
uses: hasura/[email protected]
17+
with:
18+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
19+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
20+
GITHUB_ORG: ${{ github.repository_owner }}
21+
GITHUB_REPOSITORY: ${{ github.repository }}
22+
PR_NUMBER: ${{ github.event.number }}

0 commit comments

Comments
 (0)