Skip to content

Commit

Permalink
fix: Fail the action if there are errors (#1902)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Aug 12, 2024
1 parent f48c158 commit d979ffd
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 49 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,36 @@ jobs:
``````json
${{ toJSON(steps.cspell-action.outputs) }}
``````
test-bad-config: # run the action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- uses: ./
id: cspell-action
continue-on-error: true
with:
incremental_files_only: false
files: |
fixtures/**
config: ./fixtures/cspell-missing-import.yaml
strict: false
inline: none
- name: Check Failure
if: ${{ steps.cspell-action.outputs.errors != '1' }}
run: exit 1
- name: Show Results
if: ${{ !cancelled() }}
uses: streetsidesoftware/actions/public/summary@v1
with:
text: |
outputs:
``````json
${{ toJSON(steps.cspell-action.outputs) }}
``````
conclusion:
``````json
${{ toJSON(steps.cspell-action.conclusion) }}
``````
2 changes: 2 additions & 0 deletions action-src/fixtures/missing-include/cspell-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import:
- "@cspell/dict-es-es/cspell-ext.json"
14 changes: 14 additions & 0 deletions action-src/fixtures/missing-include/missing_include.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"INPUT_GITHUB_TOKEN": "$GITHUB_TOKEN",
"INPUT_CONFIG": "fixtures/missing-include/cspell-config.yaml",
"GITHUB_EVENT_PATH": "./fixtures/push_payload.json",
"GITHUB_EVENT_NAME": "push",
"GITHUB_SHA": "a16b47a16f6c11b63cfdcf510c15ba26edd0f3d1",
"GITHUB_REF": "refs/heads/fix-resolve-path",
"GITHUB_WORKFLOW": "test-action",
"GITHUB_ACTION": "self",
"GITHUB_ACTOR": "Jason3S",
"GITHUB_JOB": "test-action",
"GITHUB_RUN_NUMBER": "7",
"GITHUB_RUN_ID": "425984531"
}
Loading

0 comments on commit d979ffd

Please sign in to comment.