This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch mandatory-label
in repository https://gitbox.apache.org/repos/asf/maven-gh-actions-shared.git

commit 7203f47559f18b736db07cad95fac352531962c6
Author: Olivier Lamy <[email protected]>
AuthorDate: Thu Jun 26 20:17:52 2025 +1000

    make label mandatory
---
 .github/workflows/pr-automation.yml | 30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/.github/workflows/pr-automation.yml 
b/.github/workflows/pr-automation.yml
index 4ae4413..529cbaa 100644
--- a/.github/workflows/pr-automation.yml
+++ b/.github/workflows/pr-automation.yml
@@ -149,31 +149,11 @@ jobs:
       toJSON(github.event.pull_request.labels) == '[]'
     runs-on: ubuntu-latest
     steps:
-
-      - name: Set default label
-        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 
v7
-        env:
-          DEFAULT_LABEL: ${{ inputs.default-label }}
-        with:
-          script: |
-            
-            console.log(context.issue.labels);
-            
-            if ( !context.issue.labels?.length ) {
-            
-              if ( !process.env.DEFAULT_LABEL ) {
-                throw new ERROR('There are no labels on PR and default label 
is not set');
-              }
-            
-              const result = await github.rest.issues.update({
-                owner: context.repo.owner,
-                repo: context.repo.repo,
-                issue_number: context.issue.number,
-                labels: [ process.env.DEFAULT_LABEL ]
-              });
-            
-              console.log(result);
-            }
+      - name: Check PR labels
+        if: ${{ github.event_name == 'pull_request' && 
join(github.event.pull_request.labels.*.name) == '' }}
+        run: |
+          echo "::error::PRs must be labeled"
+          exit 1
 
   # check PR assignee - if no one is assigned, assign to person who merge PR
   assignees:

Reply via email to