File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ const CONFIG = {
4646 const parsed = Number . parseInt ( process . env . MAX_PAGES ?? '5' , 10 ) ;
4747 return Number . isInteger ( parsed ) && parsed > 0 ? parsed : 5 ;
4848 } ) ( ) ,
49+ DRY_RUN : process . env . DRY_RUN === 'true' ,
4950} ;
5051
5152// Validates PR number is a positive integer
@@ -212,9 +213,16 @@ async function postVerificationComment(
212213 unverifiedCount ,
213214 truncated
214215) {
216+ // Skip posting in dry-run mode
217+ if ( CONFIG . DRY_RUN ) {
218+ console . log ( `[${ CONFIG . BOT_NAME } ] DRY_RUN enabled; skipping comment.` ) ;
219+ return true ;
220+ }
221+
215222 console . log ( `[${ CONFIG . BOT_NAME } ] Posting verification failure comment...` ) ;
216223
217224 try {
225+
218226 await github . rest . issues . createComment ( {
219227 owner,
220228 repo,
Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ name: PythonBot - Verify PR Commits
1313on :
1414 pull_request_target :
1515 types : [opened, synchronize]
16+ workflow_dispatch :
17+ inputs :
18+ dry_run :
19+ description : " Run without posting comments"
20+ required : false
21+ default : " true"
1622
1723permissions :
1824 contents : read
4652 # Team signature
4753 TEAM_NAME : " Hiero Python SDK Team"
4854
55+ # Dry-run mode (workflow_dispatch uses input, PR events default to false)
56+ DRY_RUN : ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
57+
4958 steps :
5059 - name : Harden the runner (Audit all outbound calls)
5160 uses : step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
5867 sparse-checkout : .github/scripts
5968 persist-credentials : false
6069
70+ - name : Log dry-run status
71+ run : echo "Dry run mode: ${{ env.DRY_RUN }}"
72+
6173 - name : Verify PR commits
6274 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
6375 id : verify
7587 return result;
7688
7789 - name : Fail if unverified commits found
78- if : steps.verify.outputs.success != 'true'
90+ if : steps.verify.outputs.success != 'true' && env.DRY_RUN != 'true'
7991 run : |
8092 echo "❌ Pull request has unverified commits."
8193 echo "Please sign your commits with GPG."
You can’t perform that action at this time.
0 commit comments