Skip to content

Commit aeb150a

Browse files
resolved comments
1 parent 35dee98 commit aeb150a

File tree

3 files changed

+53
-29
lines changed

3 files changed

+53
-29
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,37 @@ jobs:
4444
run: go build -o listener
4545

4646
release:
47-
name: Create GitHub Release
48-
needs: build
49-
runs-on: ubuntu-latest
50-
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
51-
steps:
52-
- uses: actions/checkout@v3
53-
54-
- name: Read version
55-
id: version
47+
- name: Check version
5648
run: |
5749
VERSION=$(cat VERSION.txt)
58-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
50+
echo "version=$VERSION" >> $GITHUB_ENV
51+
echo "Version: $VERSION"
52+
53+
- name: Create Tag
54+
if: |
55+
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
56+
(github.event_name == 'pull_request' &&
57+
github.event.action == 'closed' &&
58+
github.event.pull_request.merged == true &&
59+
github.event.pull_request.base.ref == 'main')
60+
run: |
61+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
62+
git config --global user.name "github-actions[bot]"
63+
git tag "v${{ env.version }}"
64+
git push origin "v${{ env.version }}"
5965
6066
- name: Create GitHub Release
61-
uses: softprops/action-gh-release@v1
67+
if: |
68+
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
69+
(github.event_name == 'pull_request' &&
70+
github.event.action == 'closed' &&
71+
github.event.pull_request.merged == true &&
72+
github.event.pull_request.base.ref == 'main')
73+
uses: softprops/action-gh-release@v2
6274
with:
63-
tag_name: v${{ steps.version.outputs.version }}
64-
name: Release v${{ steps.version.outputs.version }}
65-
body: |
66-
Automated release triggered by push to `main`.
67-
68-
**Version**: v${{ steps.version.outputs.version }}
69-
70-
_Changes in this release are based on PR history._
75+
tag_name: v${{ env.version }}
76+
name: Release v${{ env.version }}
77+
files: build/monitor.bpf.o
78+
# generate_release_notes: true
7179
env:
72-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

internal/event/event.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,11 @@ import (
44
"fmt"
55
"strings"
66
"time"
7+
"models/models"
78
)
89

9-
type Data struct {
10-
Pid uint32
11-
Uid uint32
12-
Filename [128]byte
13-
Comm [16]byte
14-
Timestamp uint64
15-
Otype [16]byte
16-
}
1710

18-
func Print(e Data) {
11+
func Print(e models.Data) {
1912
ts := time.Unix(0, int64(e.Timestamp))
2013
fmt.Printf("[%s] PID=%d, UID=%d, Operation=%s, File=%s, Process=%s\n",
2114
ts.Format("15:04:05"),

internal/models/models.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package models
2+
3+
import (
4+
"github.com/cilium/ebpf"
5+
"github.com/cilium/ebpf/link"
6+
"github.com/cilium/ebpf/ringbuf"
7+
)
8+
9+
type Data struct {
10+
Pid uint32
11+
Uid uint32
12+
Filename [128]byte
13+
Comm [16]byte
14+
Timestamp uint64
15+
Otype [16]byte
16+
}
17+
18+
19+
type BPFManager struct {
20+
Collection *ebpf.Collection
21+
Reader *ringbuf.Reader
22+
Links []link.Link
23+
}

0 commit comments

Comments
 (0)