File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 3434 with :
3535 babashka-version : 1.12.199
3636
37+ - name : Filter non-documented branches
38+ run : |
39+ bb script/check_incoming_branchname.clj $MAIN_REPO_BRANCH
40+
3741 - name : Install js dependencies
3842 run : yarn install --frozen-lockfile --prefer-offline
3943
Original file line number Diff line number Diff line change 1+ (ns check-incoming-branchname )
2+
3+ (defn usage []
4+ (println " Usage: script/check_incoming_branchname.clj branchname" )
5+ (System/exit 1 ))
6+
7+ (def release-regex #"release-x\. (\d +)\. x" )
8+
9+ (defn extract-release-num [release-branchname]
10+ (let [[_ num] (re-matches release-regex release-branchname)]
11+ num))
12+
13+ (defn categorize-branchname [branchname]
14+ (cond
15+ (= branchname " master" ) [:master ]
16+ (re-matches release-regex branchname) [:release (extract-release-num branchname)]))
17+
18+ (defn -main
19+ " This is called from the `process_docs_changes.yml` workflow. It checks that
20+ the branchname is either `master` or a release branch. If not, it exits with
21+ an error code, stopping the workflow before it goes ahead and opens a PR with
22+ the docs changes."
23+ [& args]
24+ (let [branchname (or (first args) (usage ))
25+ _ (println " Checking branchname:" branchname)
26+ [category release-num] (categorize-branchname branchname)]
27+ (case category
28+ :master (println " Master branch detected." )
29+ :release (println " Release branch detected:" release-num)
30+ (do (println " Unpublishable branchname: " branchname)
31+ (System/exit 1 )))))
32+
33+ (when (= *file* (System/getProperty " babashka.file" ))
34+ (apply -main *command-line-args*))
You can’t perform that action at this time.
0 commit comments