浏览代码

adding commit message linter

Sean OMeara 4 年之前
父节点
当前提交
190e9464ce
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      .github/workflows/badstrings.yml

+ 17 - 0
.github/workflows/badstrings.yml

@@ -0,0 +1,17 @@
+name: badstrings
+on: [pull_request, push]
+jobs:
+  badstrings:
+    runs-on: ubuntu-latest
+    steps:
+      - name: scanning commit message for bad strings
+        run: |
+          #!/bin/bash
+          set -euo pipefail
+          IFS=$'\n\t'
+          message="${{ github.event.head_commit.message }}"
+          
+          strings=($(curl -s https://raw.githubusercontent.com/someara/badstrings/main/strings.txt))
+          for i in ${strings[@]} ; do
+            echo "${message}" | grep -v "$i" &>/dev/null;
+          done