Skip to content

Commit 8945530

Browse files
committed
Merge branch 'main' of https://github.com/ChristopherHX/github-act-runner into runneradmin-flow
2 parents 0895bc6 + fa3127b commit 8945530

42 files changed

Lines changed: 2143 additions & 1446 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lint.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Go Lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.21'
22+
23+
- name: Cache Go modules
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cache/go-build
28+
~/go/pkg/mod
29+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
${{ runner.os }}-go-
32+
33+
- name: Download dependencies
34+
run: go mod download
35+
36+
- name: Run golangci-lint
37+
uses: golangci/golangci-lint-action@v8
38+
with:
39+
version: latest
40+
args: --timeout=5m

.golangci.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
version: "2"
2+
run:
3+
go: "1.24"
4+
linters:
5+
enable:
6+
- asciicheck
7+
- bidichk
8+
- bodyclose
9+
- copyloopvar
10+
- dogsled
11+
- dupl
12+
- durationcheck
13+
- errname
14+
- errorlint
15+
- exhaustive
16+
- gocheckcompilerdirectives
17+
- goconst
18+
- gocritic
19+
- goprintffuncname
20+
- gosec
21+
- importas
22+
- lll
23+
- makezero
24+
- misspell
25+
- mnd
26+
- nakedret
27+
- nilerr
28+
- noctx
29+
- nolintlint
30+
- prealloc
31+
- revive
32+
- rowserrcheck
33+
- staticcheck
34+
- tparallel
35+
- unconvert
36+
- unparam
37+
- usestdlibvars
38+
- whitespace
39+
settings:
40+
dupl:
41+
threshold: 100
42+
goconst:
43+
min-len: 2
44+
min-occurrences: 2
45+
gocritic:
46+
disabled-checks:
47+
- dupImport
48+
- ifElseChain
49+
- octalLiteral
50+
- whyNoLint
51+
- wrapperFunc
52+
enabled-tags:
53+
- diagnostic
54+
- experimental
55+
- opinionated
56+
- performance
57+
- style
58+
gocyclo:
59+
min-complexity: 15
60+
govet:
61+
enable:
62+
- shadow
63+
lll:
64+
line-length: 140
65+
misspell:
66+
locale: US
67+
revive:
68+
confidence: 0.8
69+
exclusions:
70+
generated: lax
71+
rules:
72+
- linters:
73+
- gocritic
74+
- gosec
75+
- mnd
76+
path: _test\.go
77+
- linters:
78+
- mnd
79+
path: main\.go
80+
- linters:
81+
- revive
82+
path: protocol/
83+
- linters:
84+
- gosec
85+
text: weak cryptographic primitive
86+
- linters:
87+
- gosec
88+
text: Use of weak random number generator
89+
- linters:
90+
- staticcheck
91+
text: at least one file in a package should have a package comment
92+
- linters:
93+
- staticcheck
94+
text: should have a package comment
95+
- linters:
96+
- revive
97+
text: 'package-comments: should have a package comment'
98+
- linters:
99+
- revive
100+
text: exported function .* should have comment or be unexported
101+
- linters:
102+
- revive
103+
text: exported method .* should have comment or be unexported
104+
- linters:
105+
- revive
106+
text: exported type .* should have comment or be unexported
107+
- linters:
108+
- revive
109+
text: exported var .* should have comment or be unexported
110+
paths:
111+
- third_party$
112+
- builtin$
113+
- examples$
114+
issues:
115+
max-issues-per-linter: 0
116+
max-same-issues: 0
117+
formatters:
118+
enable:
119+
- gofmt
120+
- gofumpt
121+
- goimports
122+
settings:
123+
goimports:
124+
local-prefixes:
125+
- github.com/ChristopherHX/github-act-runner
126+
exclusions:
127+
generated: lax
128+
paths:
129+
- third_party$
130+
- builtin$
131+
- examples$

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ go run . run
131131
- removed openbsd/mips binaries, because this prevents updates to go and dependencies
132132
- go 1.21 now required
133133

134+
# Breaking changes in 0.11.0
135+
- based on [actions-oss/act-cli@v0.3.4](https://github.com/actions-oss/act-cli/tree/v0.3.4)
136+
- go 1.24 now required
137+
134138
# Known Limitations
135139
- ~~This runner ignores pre and post steps of javascript actions~~ Is now working in 0.6.0
136140
- ~~[actions/cache](https://github.com/actions/cache) is incompatible and won't be able to **save your cache**~~
@@ -150,10 +154,10 @@ go run . run
150154
- Job Outputs are sent regardless if they would leak secret data to non secret storage
151155
- You need to provide the `node` program yourself in all containers / host configurations
152156
- You need to manually update the runner
153-
- Most issues of https://github.com/nektos/act/issues applies to this runner as well
157+
- Most issues of https://github.com/nektos/act/issues and https://github.com/actions-oss/act-cli/issues applies to this runner as well
154158

155159
# How does it work?
156-
This runner implements the same protocol as the [actions/runner](https://github.com/actions/runner) in a different way, as such it can be used as a self-hosted runner exactly like the official one. To get this working, I initially built an actions service replacement [ChristopherHX/runner.server](https://github.com/ChristopherHX/runner.server) for the official [actions/runner](https://github.com/actions/runner). My own actions service allowed me to implement the base protocol for this runner and debug how the protocol is serializeing and parsing json messages, while still being incompatible with github. After testing against github, the first thing happend was loosing the ability to run any github action workflows on my test repository. My invalid attempts to register a custom runner caused unrecoverable Internal Server Errors on githubs side, I decided to delete this test repository. After some work everything worked and finally it is safe to register this runner against github. To execute steps this runner translates the github actions job request to be compatible with a modified version of [nektos/act](https://github.com/nektos/act) ( [ChristopherHX/act](https://github.com/ChristopherHX/act) ), which adds a local task runner without the need for docker and increased platform support, also the log output of act gets redirected to github for live logs and storing log files.
160+
This runner implements the same protocol as the [actions/runner](https://github.com/actions/runner) in a different way, as such it can be used as a self-hosted runner exactly like the official one. To get this working, I initially built an actions service replacement [ChristopherHX/runner.server](https://github.com/ChristopherHX/runner.server) for the official [actions/runner](https://github.com/actions/runner). My own actions service allowed me to implement the base protocol for this runner and debug how the protocol is serializeing and parsing json messages, while still being incompatible with github. After testing against github, the first thing happend was loosing the ability to run any github action workflows on my test repository. My invalid attempts to register a custom runner caused unrecoverable Internal Server Errors on githubs side, I decided to delete this test repository. After some work everything worked and finally it is safe to register this runner against github. To execute steps this runner translates the github actions job request to be compatible with a modified version of [nektos/act](https://github.com/nektos/act) ( [actions-oss/act-cli](https://github.com/actions-oss/act-cli) ), which adds a local task runner without the need for docker and increased platform support, also the log output of act gets redirected to github for live logs and storing log files.
157161

158162
# Does this runner work without github?
159163
Yes, you can use this runner together with [ChristopherHX/runner.server](https://github.com/ChristopherHX/runner.server) locally on your PC without depending on compatibility with github. Also CI tests for this runner are using [ChristopherHX/runner.server](https://github.com/ChristopherHX/runner.server), this avoids requiring a PAT for github to run tests and enshures that you are always able to run it locally without github.

actionsdotnetactcompat/act_runner.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ type ActRunner struct {
99
actionsrunner.WorkerRunnerEnvironment
1010
}
1111

12-
func (arunner *ActRunner) ExecWorker(run *actionsrunner.RunRunner, wc actionsrunner.WorkerContext, jobreq *protocol.AgentJobRequestMessage, src []byte) error {
13-
if len(arunner.WorkerArgs) <= 0 {
12+
func (arunner *ActRunner) ExecWorker(run *actionsrunner.RunRunner, wc actionsrunner.WorkerContext,
13+
jobreq *protocol.AgentJobRequestMessage, src []byte,
14+
) error {
15+
if len(arunner.WorkerArgs) == 0 {
1416
ExecWorker(jobreq, wc)
1517
return nil
1618
}

0 commit comments

Comments
 (0)