From a5e54587d6689667dfc87c2f6a3b5a4236e93a9c Mon Sep 17 00:00:00 2001 From: Nick Fields Date: Tue, 29 Sep 2020 10:14:29 -0400 Subject: [PATCH] fix: fixed example in documentation --- .actiongenrc.js | 73 +++++++++++++++++++++++++++++++++++++++++++++++-- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 135 insertions(+), 6 deletions(-) diff --git a/.actiongenrc.js b/.actiongenrc.js index 1e0d711..3f03b4c 100644 --- a/.actiongenrc.js +++ b/.actiongenrc.js @@ -42,14 +42,81 @@ module.exports = buildConfig({ }, usage: { examples: [ + { + title: 'Example usage w/ exact (using default comparison) assertion', + codeLanguage: 'yaml', + codeBlock: ` +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: testing + actual: \${{ steps.test-data.outputs.value }} +`.trim(), + }, { title: 'Example usage w/ exact assertion', codeLanguage: 'yaml', codeBlock: ` -- uses: nick-invision@assert-actionv1 +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: testing + actual: \${{ steps.test-data.outputs.value }} + comparison: exact +`.trim(), + }, + { + title: 'Example usage w/ startsWith assertion', + codeLanguage: 'yaml', + codeBlock: ` +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: test + actual: \${{ steps.test-data.outputs.value }} + comparison: startsWith +`.trim(), + }, + { + title: 'Example usage w/ endsWith assertion', + codeLanguage: 'yaml', + codeBlock: ` +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: ing + actual: \${{ steps.test-data.outputs.value }} + comparison: endsWith +`.trim(), + }, + { + title: 'Example usage w/ contains assertion', + codeLanguage: 'yaml', + codeBlock: ` +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: est + actual: \${{ steps.test-data.outputs.value }} + comparison: endsWith +`.trim(), + }, + { + title: 'Example usage w/ notEqual assertion', + codeLanguage: 'yaml', + codeBlock: ` +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 with: - expected: \${{ secrets.REPO_TOKEN }} - actual: \${{ steps.outputs }} + expected: abc + actual: \${{ steps.test-data.outputs.value }} + comparison: notEqual `.trim(), }, ], diff --git a/README.md b/README.md index 3559b58..3e423c2 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,75 @@ Various assertions to aide in validating action outputs ## **Examples** +### Example usage w/ exact (using default comparison) assertion + +```yaml +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: testing + actual: ${{ steps.test-data.outputs.value }} +``` + ### Example usage w/ exact assertion ```yaml -- uses: nick-invision@assert-actionv1 +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: testing + actual: ${{ steps.test-data.outputs.value }} + comparison: exact +``` + +### Example usage w/ startsWith assertion + +```yaml +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: test + actual: ${{ steps.test-data.outputs.value }} + comparison: startsWith +``` + +### Example usage w/ endsWith assertion + +```yaml +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: ing + actual: ${{ steps.test-data.outputs.value }} + comparison: endsWith +``` + +### Example usage w/ contains assertion + +```yaml +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 + with: + expected: est + actual: ${{ steps.test-data.outputs.value }} + comparison: endsWith +``` + +### Example usage w/ notEqual assertion + +```yaml +- id: test-data + run: echo "::set-output name=value::testing" +- uses: nick-invision@assert-action@v1 with: - expected: ${{ secrets.REPO_TOKEN }} - actual: ${{ steps.outputs }} + expected: abc + actual: ${{ steps.test-data.outputs.value }} + comparison: notEqual ``` ---