File tree Expand file tree Collapse file tree 7 files changed +64
-22
lines changed Expand file tree Collapse file tree 7 files changed +64
-22
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+ set -eu
3+ repo_root=" $( git rev-parse --show-toplevel) "
4+ cd " $repo_root " || exit 1
5+
6+ repo_name=" $( basename " $repo_root " ) "
7+ forbidden=$( git grep -n " $repo_name " -- ' :!internal/' ' :!docs/' ' :!go.mod' ' :!main.go' ' :!mkdocs.yml' || true)
8+ if [ -n " $forbidden " ]; then
9+ echo " ERROR: Found references to '$repo_name ' outside of internal/ or docs/ directories:"
10+ echo " $forbidden "
11+ exit 1
12+ fi
Original file line number Diff line number Diff line change 1+ name : " Keep generic"
2+ description : " Fail if repo name is hardcoded somewhere its not supposed to."
3+
4+ runs :
5+ using : " composite"
6+ steps :
7+ - name : Keep generic
8+ shell : sh
9+ run : |
10+ "$GITHUB_ACTION_PATH/action.sh"
Original file line number Diff line number Diff line change 1+ name : " Rubocop formula"
2+ description : " Run rubocop on the render formula"
3+
4+ runs :
5+ using : " composite"
6+ steps :
7+ - name : Render out final formula
8+ shell : sh
9+ env :
10+ GH_TOKEN : ${{ github.token }}
11+ run : |
12+ ./dist/brew/render.bash
13+ - uses : anttiharju/actions/rubocop-file@v1
14+ with :
15+ file : " dist/brew/.${{ github.event.repository.name }}.rb"
Original file line number Diff line number Diff line change @@ -68,20 +68,28 @@ jobs:
6868 name : golangci-lint
6969 uses : anttiharju/actions/golangci-lint@v1
7070
71- - if : always() && (steps.changed.outputs.documentation == 'true' || github.event_name != 'pull_request')
72- name : MkDocs
73- uses : anttiharju/ actions/mkdocs-build-strict@v1
71+ - if : always()
72+ name : Keep generic
73+ uses : ./.github/ actions/keep-generic
7474
7575 - if : always()
76- name : keep- yml
76+ name : Keep . yml
7777 uses : anttiharju/actions/keep-yml@v1
7878
79+ - if : always() && (steps.changed.outputs.documentation == 'true' || github.event_name != 'pull_request')
80+ name : MkDocs
81+ uses : anttiharju/actions/mkdocs-build-strict@v1
82+
7983 - if : always() && (steps.changed.outputs.md_and_yml == 'true' || github.event_name != 'pull_request')
8084 name : Prettier
8185 uses : anttiharju/actions/prettier@v1
8286 with :
8387 patterns : " {*.yml,*.md}"
8488
89+ - if : always() && (steps.changed.outputs.dist_brew == 'true' || github.event_name != 'pull_request')
90+ name : Rubocop formula
91+ uses : ./.github/actions/rubocop-formula
92+
8593 - if : always() && (steps.changed.outputs.scripts == 'true' || github.event_name != 'pull_request')
8694 name : ShellCheck
8795 uses : anttiharju/actions/shellcheck@v1
Original file line number Diff line number Diff line change @@ -49,3 +49,6 @@ dist/brew/*.rb
4949
5050# Packaging happens under this directory
5151tmp
52+
53+ # rubocop-file action
54+ /* .lock
Original file line number Diff line number Diff line change @@ -32,14 +32,15 @@ if [[ "$quick_mode" == true ]] && [[ -f "$cache_file" ]]; then
3232else
3333 echo " Generating fresh values"
3434
35- # Only download binaries if the tag has changed or cache doesn't exist
36- if [[ " $cached_tag " != " $TAG " ]]; then
37- echo " New release detected: $TAG (was: ${cached_tag:- none} )"
38- gh release download " $TAG " --pattern " $repo_name -*64.tar.gz"
35+ if [[ " $cached_tag " != " $TAG " ]] || [[ -z " $TAG " ]]; then
36+ echo " New release detected: ${TAG:- empty} (was: ${cached_tag:- none} )"
37+ gh release download --pattern " $repo_name -*64.tar.gz"
3938 find . -name " $repo_name -*64.tar.gz" -exec mv {} " $repo_root /" \;
4039
41- # Cache the latest tag
42- echo " $TAG " > " $tag_cache_file "
40+ # Cache the latest tag only if it's not empty
41+ if [[ -n " $TAG " ]]; then
42+ echo " $TAG " > " $tag_cache_file "
43+ fi
4344 else
4445 echo " Using cached binaries for tag: $TAG "
4546 fi
Original file line number Diff line number Diff line change @@ -33,24 +33,17 @@ pre-commit:
3333 run : golangci-lint run --fix
3434 stage_fixed : true
3535
36- - name : MkDocs
37- glob : " {docs/*,mkdocs.yml}"
38- run : mkdocs build --strict
39-
4036 - name : Keep generic
41- run : |
42- repo_name="$(basename "$(pwd)")"
43- forbidden=$(git grep -l "$repo_name" -- ':!internal/' ':!docs/' ':!go.mod' ':!main.go' ':!mkdocs.yml' || true)
44- if [ -n "$forbidden" ]; then
45- echo "ERROR: Found references to '$repo_name' outside of internal/ or docs/ directories:"
46- echo "$forbidden"
47- exit 1
48- fi
37+ run : ./.github/actions/keep-generic/action.sh
4938
5039 - name : Keep .yml
5140 glob : " *.yaml"
5241 run : echo "You are trying to commit .yaml files. Please use .yml instead for the following files:" && echo {staged_files} && exit 1
5342
43+ - name : MkDocs
44+ glob : " {docs/*,mkdocs.yml}"
45+ run : mkdocs build --strict
46+
5447 - name : Prettier
5548 glob : " {*.yml,*.md}"
5649 run : prettier --write {staged_files}
You can’t perform that action at this time.
0 commit comments