summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2024-03-13 22:37:18 +0900
committerGitHub <noreply@github.com>2024-03-13 22:37:18 +0900
commit29f6ba6310e162d6e24c9075ddd6176c155a10e7 (patch)
tree25b053df007fe66add8969a8704d393b18920e05 /.github/workflows
parentrefactor(backend): UserEntityService.packMany()の高速化 (#13550) (diff)
downloadsharkey-29f6ba6310e162d6e24c9075ddd6176c155a10e7.tar.gz
sharkey-29f6ba6310e162d6e24c9075ddd6176c155a10e7.tar.bz2
sharkey-29f6ba6310e162d6e24c9075ddd6176c155a10e7.zip
chore: add missing SPDX ID and workflow check (#13570)
* chore: add workflow which checks if SPDX ID exists * chore: add missing SPDX ID in some files * chore: change trigger condition * chore: trigger on push * lint
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/check-spdx-license-id.yml75
1 files changed, 75 insertions, 0 deletions
diff --git a/.github/workflows/check-spdx-license-id.yml b/.github/workflows/check-spdx-license-id.yml
new file mode 100644
index 0000000000..6cd8bf60d5
--- /dev/null
+++ b/.github/workflows/check-spdx-license-id.yml
@@ -0,0 +1,75 @@
+name: Check SPDX-License-Identifier
+
+on:
+ push:
+ branches:
+ - master
+ - develop
+ pull_request:
+
+jobs:
+ check-spdx-license-id:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4.1.1
+ - name: Check
+ run: |
+ counter=0
+
+ search() {
+ local directory="$1"
+ find "$directory" -type f \
+ '(' \
+ -name "*.cjs" -and -not -name '*.config.cjs' -o \
+ -name "*.html" -o \
+ -name "*.js" -and -not -name '*.config.js' -o \
+ -name "*.mjs" -and -not -name '*.config.mjs' -o \
+ -name "*.scss" -o \
+ -name "*.ts" -and -not -name '*.config.ts' -o \
+ -name "*.vue" \
+ ')' -and \
+ -not -name '*eslint*'
+ }
+
+ check() {
+ local file="$1"
+ if ! (
+ grep -q "SPDX-FileCopyrightText: syuilo and misskey-project" "$file" ||
+ grep -q "SPDX-License-Identifier: AGPL-3.0-only" "$file"
+ ); then
+ echo "Missing: $file"
+ ((counter++))
+ fi
+ }
+
+ directories=(
+ "cypress/e2e"
+ "packages/backend/migration"
+ "packages/backend/src"
+ "packages/backend/test"
+ "packages/frontend/.storybook"
+ "packages/frontend/@types"
+ "packages/frontend/lib"
+ "packages/frontend/public"
+ "packages/frontend/src"
+ "packages/frontend/test"
+ "packages/misskey-bubble-game/src"
+ "packages/misskey-reversi/src"
+ "packages/sw/src"
+ "scripts"
+ )
+
+ for directory in "${directories[@]}"; do
+ for file in $(search $directory); do
+ check "$file"
+ done
+ done
+
+ if [ $counter -gt 0 ]; then
+ echo "SPDX-License-Identifier is missing in $counter files."
+ exit 1
+ else
+ echo "SPDX-License-Identifier is certainly described in all target files!"
+ exit 0
+ fi