Skip to content

Commit d54d1f7

Browse files
committed
update workflows
1 parent 73aec04 commit d54d1f7

9 files changed

Lines changed: 59 additions & 47 deletions

File tree

.github/workflows/ci-binary.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "[CI] Build binary and unit testing"
1+
name: "[CI] Build and unit testing"
22

33
on:
44
workflow_dispatch:
@@ -458,8 +458,8 @@ jobs:
458458
if: ${{ github.event.inputs.README == 'true' && env.VERSION != '' }}
459459
run: |
460460
sed -i -E "s|releases/download/[0-9.]+/lazyjournal-[0-9.]+-|releases/download/$VERSION/lazyjournal-$VERSION-|" README.md
461-
git config --global user.name "github-actions[bot]"
462-
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
461+
git config --global user.name 'GitHub Actions'
462+
git config --global user.email 'actions@github.com'
463463
git add README.md
464464
git commit -m "update version on $VERSION for install deb package"
465465
git push origin main

.github/workflows/go-coverage-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ jobs:
494494
- name: Update markdown report on Wiki
495495
if: ${{ github.event.inputs.Markdown == 'true' }}
496496
run: |
497-
echo -e '# Report for $(go run main.go -v) release\n' > wiki/home.md
497+
echo -e "# Report for $(go run main.go -v) release\n" > wiki/home.md
498498
echo -e 'The test coverage report in `html` format using [go-coverage-report](https://github.com/marketplace/actions/go-coverage-report) is available [here](https://raw.githubusercontent.com/wiki/Lifailon/lazyjournal/coverage.html).\n' >> wiki/home.md
499499
echo -e 'During testing, the interface operation is checked in the disabled `tcell` mode, as well as the reading and coloring time of all available logs in Linux, macOS and Windows systems.\n' >> wiki/home.md
500500
echo -e 'To combine test results from different systems [gosovmerge](https://github.com/wadey/gocovmerge) is used.\n' >> wiki/home.md

.github/workflows/go-lint-fix.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,20 @@ jobs:
8282
text=$(echo $RESULTS | jq -r .Issues[0].Text)
8383
code=$(echo $RESULTS | jq -r .Issues[0].SourceLines[0])
8484
line=$(echo $RESULTS | jq -r .Issues[0].Pos.Line)
85+
line=$(echo "$line" | tr -d '\r')
86+
lines_offset=$(echo "${{ github.event.inputs.LINES }}" | tr -d '\r')
87+
start=$((line - lines_offset))
88+
[ $start -le 0 ] && start=1 # Защита от отрицательных строк
89+
end=$((line + lines_offset))
8590
echo "ISSUE_LINT=$lint" >> $GITHUB_ENV
8691
echo "ISSUE_TEXT=$text" >> $GITHUB_ENV
8792
echo "ISSUE_CODE=$code" >> $GITHUB_ENV
8893
echo "ISSUE_LINE=$line" >> $GITHUB_ENV
89-
line=$(echo "$line" | tr -d '\r')
90-
lines=$(echo "${{ github.event.inputs.LINES }}" | tr -d '\r')
91-
start=$((line - lines))
92-
end=$((line + lines))
93-
echo "c=$start" >> $GITHUB_ENV
94+
echo "START_LINE=$start" >> $GITHUB_ENV
9495
echo "END_LINE=$end" >> $GITHUB_ENV
95-
context=$(sed -n "${start},${end}p" "${{ github.event.inputs.FILE }}")
96-
echo "CONTEXT=$context" >> $GITHUB_ENV
96+
echo "CONTEXT<<EOF" >> $GITHUB_ENV
97+
sed -n "${start},${end}p" "${{ github.event.inputs.FILE }}" >> $GITHUB_ENV
98+
echo "EOF" >> $GITHUB_ENV
9799
98100
- name: Fix issue using AI
99101
id: ai_query
@@ -105,24 +107,27 @@ jobs:
105107
You are an issues analyzer from the golangci linters for the Go language.
106108
Your task is never to answer questions, but only to correct the given piece of code.
107109
You will be provided with the linter name, error text, and code context.
108-
Always return the same number of lines of code in your response as was given to you.
109110
Never change the logic of the source code or add analysis text to the response.
111+
Output ONLY raw code. Do NOT use markdown code blocks.
112+
Your answer should always include the same number of lines of code as was provided to you (excluding corrections).
110113
prompt: |
111114
Linter: ${{ env.ISSUE_LINT }}
112115
Issue text: ${{ env.ISSUE_TEXT }}
113116
Line of code with an error: ${{ env.ISSUE_CODE }}
114117
Context:
115118
${{ env.CONTEXT }}
116119
117-
- name: Update CHANGELOG file
118-
env:
119-
AI_RESPONSE: ${{ steps.ai_query.outputs.response }}
120+
- name: Update file
120121
run: |
121-
FILE=$(echo "${{ github.event.inputs.FILE }}" | sed "s/.go//")
122-
head -n $((START_LINE - 1)) $FILE > $FILE-fix.go
123-
echo $CONTEXT >> $FILE-fix.go
124-
tail -n +$((END_LINE + 1)) $FILE >> $FILE-fix.go
125-
mv $FILE-fix.go $FILE
122+
GO_FILE=${{ github.event.inputs.FILE }}
123+
TMP_FILE=$(echo $(echo "$GO_FILE" | sed "s/.go//")-fix.go)
124+
head -n $((START_LINE - 1)) "$GO_FILE" > "$TMP_FILE"
125+
cat <<'EOF' >> "$TMP_FILE"
126+
${{ steps.ai_query.outputs.response }}
127+
EOF
128+
tail -n +$((END_LINE + 1)) "$GO_FILE" >> "$TMP_FILE"
129+
mv "$TMP_FILE" "$GO_FILE"
130+
go fmt "$GO_FILE"
126131
127132
- name: Getting linter check results in json format after fixing
128133
run: |
@@ -142,4 +147,4 @@ jobs:
142147
title: "Fixed linters"
143148
body: "Fixing linters with AI from GitHub Actions."
144149
add-paths: |
145-
${{ github.event.inputs.file }})
150+
${{ github.event.inputs.file }}

.github/workflows/go-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
- name: Create git tag and branch for new version
4646
if: ${{ github.event.inputs.Tag == 'true' }}
4747
run: |
48-
git config --global user.name "github-actions[bot]"
49-
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
48+
git config --global user.name 'GitHub Actions'
49+
git config --global user.email 'actions@github.com'
5050
git tag $VERSION
5151
git checkout -b "release/$VERSION"
5252
git push origin "release/$VERSION" $VERSION

.github/workflows/sast-codacy.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: "[SAST] Codacy"
22

33
on:
4-
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
4+
workflow_dispatch:
5+
# push:
6+
# branches: ["main"]
7+
# pull_request:
8+
# branches: ["main"]
89

910
permissions:
1011
contents: read
@@ -46,4 +47,4 @@ jobs:
4647
- name: Upload SARIF results file
4748
uses: github/codeql-action/upload-sarif@v3
4849
with:
49-
sarif_file: results.sarif
50+
sarif_file: results.sarif

.github/workflows/sast-codeql.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: "[SAST] CodeQL"
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches: [ "main" ]
6+
branches: ["main"]
67
pull_request:
7-
branches: [ "main" ]
8+
branches: ["main"]
89

910
jobs:
1011
analyze:
@@ -49,4 +50,4 @@ jobs:
4950
- name: Perform CodeQL Analysis
5051
uses: github/codeql-action/analyze@v4
5152
with:
52-
category: "/language:${{matrix.language}}"
53+
category: "/language:${{matrix.language}}"

.github/workflows/sast-semgrep.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
11
name: "[SAST] Semgrep"
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches: [ "main" ]
6+
branches: ["main"]
67
pull_request:
7-
branches: [ "main" ]
8+
branches: ["main"]
89

910
permissions:
1011
contents: read
1112

1213
jobs:
1314
semgrep:
14-
name: Scan
15+
name: semgrep/ci
1516
runs-on: ubuntu-latest
1617

1718
permissions:
1819
contents: read
1920
security-events: write
2021
actions: read
2122

23+
# A Docker image with semgrep installed
24+
container:
25+
image: semgrep/semgrep
26+
27+
# Skip any PR created by dependabot
28+
if: (github.actor != 'dependabot[bot]')
29+
2230
steps:
2331
- uses: actions/checkout@v6
2432

25-
- uses: returntocorp/semgrep-action@fcd5ab7459e8d91cb1777481980d1b18b4fc6735
26-
with:
27-
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
28-
publishDeployment: ${{ secrets.SEMGREP_DEPLOYMENT_ID }}
29-
generateSarif: "1"
33+
- run: semgrep scan --config auto --sarif --output=semgrep.sarif
3034

3135
- name: Upload SARIF file
32-
uses: github/codeql-action/upload-sarif@v3
36+
uses: github/codeql-action/upload-sarif@v4
3337
with:
3438
sarif_file: semgrep.sarif
35-
if: always()
39+
if: always()

.github/workflows/sast-snyk.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: "[SAST] Snyk"
22

33
on:
4-
push:
5-
branches: ["main" ]
6-
pull_request:
7-
branches: ["main"]
4+
workflow_dispatch:
5+
# push:
6+
# branches: ["main"]
7+
# pull_request:
8+
# branches: ["main"]
89

910
permissions:
1011
contents: read
@@ -36,4 +37,4 @@ jobs:
3637
- name: Upload result to GitHub Code Scanning
3738
uses: github/codeql-action/upload-sarif@v4
3839
with:
39-
sarif_file: snyk-code.sarif
40+
sarif_file: snyk-code.sarif

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<a href="https://aur.archlinux.org/packages/lazyjournal"><img title="Arch Linux" src="https://img.shields.io/aur/version/lazyjournal?logo=arch-linux&color=blue&label=AUR"></a>
1111
<a href="https://hub.docker.com/r/lifailon/lazyjournal"><img title="Docker Hub" src="https://img.shields.io/docker/image-size/lifailon/lazyjournal/latest?logo=docker&color=blue&label=Docker+Hub"></a>
1212
<br>
13-
<a href="https://github.com/Lifailon/lazyjournal/actions/workflows/build.yml"><img title="Actions Build"src="https://github.com/Lifailon/lazyjournal/actions/workflows/build.yml/badge.svg"></a>
13+
<a href="https://github.com/Lifailon/lazyjournal/actions/workflows/ci-binary.yml"><img title="Actions Build"src="https://github.com/Lifailon/lazyjournal/actions/workflows/ci-binary.yml/badge.svg"></a>
1414
<a href="https://github.com/Lifailon/lazyjournal/wiki"><img title="Go coverage report"src="https://raw.githubusercontent.com/wiki/Lifailon/lazyjournal/coverage.svg"></a>
1515
<a href="https://goreportcard.com/report/github.com/Lifailon/lazyjournal"><img src="https://goreportcard.com/badge/github.com/Lifailon/lazyjournal" alt="Go Report"></a>
1616
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2FLifailon%2Flazyjournal?ref=badge_shield&issueType=security" alt="FOSSA Status"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2FLifailon%2Flazyjournal.svg?type=shield&issueType=security"/></a>

0 commit comments

Comments
 (0)