#2: Fix error reporting

This commit is contained in:
mtkennerly 2023-03-28 23:21:23 +08:00
parent 66bb6c8842
commit c1b34a8a25
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
3 changed files with 10 additions and 32 deletions

View file

@ -1,30 +0,0 @@
on:
- workflow_dispatch
name: Errors
jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.7'
- uses: ./
name: before checkout
continue-on-error: true
- uses: actions/checkout@v3
with:
# This is necessary so that we have the tags.
fetch-depth: 0
- uses: ./
name: invalid VCS
continue-on-error: true
with:
command: dunamai from incorrect

View file

@ -23,6 +23,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- uses: ./ - uses: ./
name: full invocation
id: full id: full
with: with:
install: '1.13.2' install: '1.13.2'
@ -36,5 +37,12 @@ jobs:
- run: echo ${{ steps.full.outputs.version }} from outputs - run: echo ${{ steps.full.outputs.version }} from outputs
- uses: ./ - uses: ./
name: minimal invocation
id: minimal id: minimal
- run: echo ${{ steps.minimal.outputs.version }} from outputs - run: echo ${{ steps.minimal.outputs.version }} from outputs
- uses: ./
name: invalid VCS
continue-on-error: true
with:
command: dunamai from incorrect

View file

@ -25,11 +25,11 @@ def set_failed(error: Exception) -> None:
stdout = getattr(error, "stdout", None) stdout = getattr(error, "stdout", None)
if stdout is not None: if stdout is not None:
print("stdout: {}".format(stdout)) print("stdout: {}".format(stdout.decode("utf-8").strip()))
stderr = getattr(error, "stderr", None) stderr = getattr(error, "stderr", None)
if stderr is not None: if stderr is not None:
print("stderr: {}".format(stdout)) print("stderr: {}".format(stdout.decode("utf-8").strip()))
def main() -> None: def main() -> None: