chore: optimize and fix github actions (cleanup, CI fixes, security scanner tuning)

This commit is contained in:
Bot
2026-04-26 22:25:00 +08:00
parent b4a0641177
commit c606fd99f6
12 changed files with 38 additions and 436 deletions
-79
View File
@@ -1,79 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '15 20 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Generate swagger docs before build (cmd/dashboard/docs is .gitignored)
- name: Generate swagger docs
run: |
go install github.com/swaggo/swag/cmd/swag@latest
swag init --pd -d . -g ./cmd/dashboard/main.go -o ./cmd/dashboard/docs --requiredByDefault
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
-29
View File
@@ -1,29 +0,0 @@
name: Contributors
on:
push:
branches: [master]
jobs:
contributors:
runs-on: ubuntu-latest
steps:
- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
id: contributors
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
hideName: 'false' # Hide names in htmlTable
avatarSize: 50 # Set the avatar size.
truncate: 6
avatarMargin: 8
- name: Modify htmlTable README.md
uses: jaywcjlove/github-action-modify-file-content@main
with:
message: update contributors[no ci]
token: ${{ secrets.NAIBA_PAT }}
openDelimiter: '<!--GAMFC_DELIMITER-->'
closeDelimiter: '<!--GAMFC_DELIMITER_END-->'
path: README.md
body: '${{steps.contributors.outputs.htmlList}}'
+3
View File
@@ -7,6 +7,9 @@ on:
branches:
- dev
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
strategy:
-16
View File
@@ -1,16 +0,0 @@
name: Sync Code to AtomGit
on:
push:
branches: [master]
jobs:
sync-code-to-atomgit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: adambirds/sync-github-to-gitlab-action@v1.1.0
with:
destination_repository: git@atomgit.com:naiba/nezha-dashboard.git
destination_branch_name: master
destination_ssh_key: ${{ secrets.ATOMGIT_SSH_KEY }}
-16
View File
@@ -1,16 +0,0 @@
name: Sync
on:
push:
branches: [master]
jobs:
sync-to-jihulab:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: adambirds/sync-github-to-gitlab-action@v1.1.0
with:
destination_repository: git@gitee.com:naibahq/nezha.git
destination_branch_name: master
destination_ssh_key: ${{ secrets.GITEE_SSH_KEY }}
@@ -1,17 +0,0 @@
name: Sync Release to AtomGit
on:
workflow_dispatch:
jobs:
sync-release-to-atomgit:
runs-on: ubuntu-latest
timeout-minutes: 120
env:
ATOMGIT_PAT: ${{ secrets.ATOMGIT_PAT }}
steps:
- uses: actions/checkout@v4
- name: Sync to AtomGit
run: |
pip3 install PyGitHub
python3 .github/sync_atomgit.py
-17
View File
@@ -1,17 +0,0 @@
name: Sync Release to Gitee
on:
workflow_dispatch:
jobs:
sync-release-to-gitee:
runs-on: ubuntu-latest
timeout-minutes: 120
env:
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Sync to Gitee
run: |
pip3 install PyGitHub
python3 .github/sync.py
+4 -1
View File
@@ -22,6 +22,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
env:
GO111MODULE: on
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- uses: actions/checkout@v4
@@ -30,8 +31,10 @@ jobs:
go-version: "1.26.x"
- name: generate swagger docs
shell: bash
run: |
go install github.com/swaggo/swag/cmd/swag@latest
mkdir -p ./cmd/dashboard/user-dist ./cmd/dashboard/admin-dist
touch ./cmd/dashboard/user-dist/a
touch ./cmd/dashboard/admin-dist/a
swag init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs
@@ -49,4 +52,4 @@ jobs:
env:
GOTOOLCHAIN: auto
with:
args: --exclude=G104,G115,G117,G203,G402,G703,G704 ./...
args: --exclude=G103,G104,G107,G115,G117,G203,G402,G703,G704 ./...