feat: initial implementation #5
4 changed files with 32 additions and 24 deletions
|
@ -7,8 +7,6 @@ jobs:
|
||||||
lint:
|
lint:
|
||||||
name: Lint Pr Title
|
name: Lint Pr Title
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: golang
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install go
|
- name: Install go
|
||||||
|
@ -17,5 +15,4 @@ jobs:
|
||||||
go-version: 1.24.2
|
go-version: 1.24.2
|
||||||
|
|
||||||
- name: Run Pull Request Lint Action
|
- name: Run Pull Request Lint Action
|
||||||
if: ${{ always() }}
|
|
||||||
uses: https://git.kjan.de/actions/pull-request-lint@main
|
uses: https://git.kjan.de/actions/pull-request-lint@main
|
||||||
|
|
|
@ -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 }}'
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: 'Pull Request Lint'
|
name: 'Pull Request Lint'
|
||||||
description: 'Validates a pull request for semantical commit message'
|
description: 'Validates a pull request for semantical commit message'
|
||||||
runs:
|
runs:
|
||||||
using: 'go'
|
using: 'node16'
|
||||||
main: 'main.go'
|
main: 'invoke-binary.js'
|
||||||
|
|
30
invoke-binary.js
Normal file
30
invoke-binary.js
Normal file
|
@ -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()
|
Loading…
Add table
Add a link
Reference in a new issue