11---
2+ # checkov:skip=CKV_GHA_1:FIXME
23name : Lifecycle
34
45" on " :
@@ -13,6 +14,7 @@ name: Lifecycle
1314 - reopened
1415 workflow_dispatch :
1516 inputs :
17+ # checkov:skip=CKV_GHA_7:These inputs are used to construct the build matrix
1618 dirs :
1719 description : Comma-delimited directories to build and run (i.e. api,1_20,1_21 )
1820 default : " all"
@@ -29,6 +31,7 @@ concurrency: # FIXME: prevent release commit cancellation
2931
3032jobs :
3133 release-please :
34+ if : github.event.action != 'closed'
3235 name : Release Please
3336 runs-on : blacksmith-2vcpu-ubuntu-2204
3437 outputs :
@@ -45,9 +48,109 @@ jobs:
4548 with :
4649 token : ${{ secrets.GITHUB_TOKEN }}
4750
51+ lint :
52+ name : Linters
53+ runs-on : blacksmith-2vcpu-ubuntu-2204
54+ # if: |
55+ # github.event.action != 'closed'
56+ # && !contains(github.actor, 'darcusk')
57+ env :
58+ APPLY_FIXES : all
59+ APPLY_FIXES_EVENT : all
60+ APPLY_FIXES_MODE : commit
61+ outputs :
62+ changes_detected : ${{ steps.autocommit.outputs.changes_detected }}
63+ commit_hash : ${{ steps.autocommit.outputs.commit_hash }}
64+ permissions :
65+ contents : write
66+ issues : write
67+ pull-requests : write
68+ steps :
69+ - name : Checkout
70+ uses : actions/checkout@v4
71+ with :
72+ fetch-depth : 1
73+ ref : ${{ github.head_ref }}
74+
75+ - name : Paths filter
76+ uses : dorny/paths-filter@v3.0.2
77+ id : filter
78+ with :
79+ list-files : shell
80+ filters : |
81+ addedOrModified:
82+ - added|modified: '**'
83+
84+ - name : Setup Python
85+ uses : useblacksmith/setup-python@v6
86+ with :
87+ python-version : " 3.12"
88+
89+ - name : Cache pre-commit
90+ uses : useblacksmith/cache@v5
91+ with :
92+ path : ~/.cache/pre-commit
93+ key : pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
94+
95+ - name : Install pre-commit
96+ shell : bash
97+ run : |
98+ python -m pip install pre-commit==4.0.1
99+ python -m pip freeze --local
100+
101+ - name : Run pre-commit
102+ id : precommit
103+ shell : bash
104+ run : |
105+ # Run against changes if addedOrModified is true, else run against all files
106+ if [[ "${{ steps.filter.outputs.addedOrModified }}" == "true" ]]; then
107+ pre-commit run --show-diff-on-failure --color=always --files "${{ steps.filter.outputs.addedOrModified_files }}" || RETRY="changes"
108+ else
109+ pre-commit run --show-diff-on-failure --color=always --all-files || RETRY="allfiles"
110+ fi
111+
112+ # Retry logic
113+ if [[ "$RETRY" == "changes" ]]; then
114+ pre-commit run --show-diff-on-failure --color=always --files "${{ steps.filter.outputs.addedOrModified_files }}"
115+ elif [[ "$RETRY" == "allfiles" ]]; then
116+ pre-commit run --show-diff-on-failure --color=always --all-files
117+ fi
118+
119+ - name : Run Mega-Linter
120+ if : ${{ !cancelled() }}
121+ uses : oxsecurity/megalinter/flavors/java@v8.3.0
122+
123+ - name : Archive production artifacts
124+ if : ${{ !cancelled() }}
125+ uses : actions/upload-artifact@v4
126+ with :
127+ name : Mega-Linter reports
128+ path : |
129+ megalinter-reports
130+ mega-linter.log
131+
132+ - name : Add reports directory to gitignore
133+ if : ${{ !cancelled() }}
134+ run : |
135+ touch .gitignore; grep -qxF 'megalinter-reports/' .gitignore ||
136+ echo 'megalinter-reports/' >> .gitignore
137+ wget https://raw.githubusercontent.com/packwiz/packwiz/refs/heads/main/go.sum
138+
139+ - name : Prepare commit
140+ if : ${{ !cancelled() }}
141+ run : sudo chown -Rc $UID .git/
142+
143+ - name : Commit and push applied linter fixes
144+ id : autocommit
145+ if : ${{ !cancelled() }}
146+ uses : stefanzweifel/git-auto-commit-action@v5.0.1
147+ with :
148+ branch : ${{ github.head_ref }}
149+ commit_message : " chore: apply linter fixes"
150+
48151 matrices :
49- if : github.event.action != 'closed'
50152 name : Construct matrices
153+ if : github.job == 'notajob'
51154 needs : release-please
52155 runs-on : blacksmith-2vcpu-ubuntu-2204
53156 outputs :
0 commit comments