From 72b5dd18f33c45072e4efeaf7a6922683ee3761f Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Wed, 9 Apr 2025 18:07:13 +0200 Subject: [PATCH] build(workflows): update CI configuration and remove test file --- .gitea/workflows/pr.yml | 3 --- .gitea/workflows/test.yml | 19 ------------------- action.yml | 4 ++-- invoke-binary.js | 30 ++++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 24 deletions(-) delete mode 100644 .gitea/workflows/test.yml create mode 100644 invoke-binary.js diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index f243f5f..fde0cf4 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -7,8 +7,6 @@ jobs: lint: name: Lint Pr Title runs-on: ubuntu-latest - container: - image: golang steps: - name: Install go @@ -17,5 +15,4 @@ jobs: go-version: 1.24.2 - name: Run Pull Request Lint Action - if: ${{ always() }} uses: https://git.kjan.de/actions/pull-request-lint@main diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml deleted file mode 100644 index 5cf5f4b..0000000 --- a/.gitea/workflows/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: 'Test Go Action' -on: [push] -jobs: - use-go-action: - runs-on: ubuntu-latest - steps: - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: '1.20' - - - name: Use Go Action - id: use-go-action - uses: https://gitea.com/Zettat123/simple-go-action@v1 - with: - username: foo - - - name: Print Output - run: echo 'output time is ${{ steps.use-go-action.outputs.time }}' diff --git a/action.yml b/action.yml index 524d19d..adf9038 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: 'Pull Request Lint' description: 'Validates a pull request for semantical commit message' runs: - using: 'go' - main: 'main.go' + using: 'node16' + main: 'invoke-binary.js' diff --git a/invoke-binary.js b/invoke-binary.js new file mode 100644 index 0000000..69baa60 --- /dev/null +++ b/invoke-binary.js @@ -0,0 +1,30 @@ +const childProcess = require('child_process') +const path = require('path') + +function runGo() { + const goProcess = childProcess.spawnSync( + 'go', + ['run', '.'], + { + cwd: __dirname, + stdio: 'inherit', + shell: true, + }, + ) + + if (goProcess.error) { + console.error('Failed to execute `go run .`:', goProcess.error) + process.exit(1) + } + + if (goProcess.status !== 0) { + console.error( + '`go run .` exited with code', + goProcess.status, + goProcess.stderr ? goProcess.stderr.toString() : '', + ) + process.exit(goProcess.status) + } +} + +runGo()