Commit 76cfb3f5008 for woocommerce
commit 76cfb3f500852a3d09f2d32884db0aba41cb8f2d
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date: Wed Aug 26 15:33:22 2026 +0300
Replace abandoned node12 label actions with a local composite action (#66598)
Add a reusable composite action, .github/actions/manage-labels, that adds, removes, or swaps labels through github.rest.issues on node24. A missing label is skipped on removal, matching the old behaviour. update-feedback-labels.yml and triage-replies.yml now call it and sparse-checkout .github/actions so the runner has the action files. Replaces actions-ecosystem/action-add-labels and action-remove-labels which are not maintained.
diff --git a/.github/actions/manage-labels/action.yml b/.github/actions/manage-labels/action.yml
new file mode 100644
index 00000000000..287e4b7c736
--- /dev/null
+++ b/.github/actions/manage-labels/action.yml
@@ -0,0 +1,47 @@
+name: 'Manage labels'
+description: 'Add, remove, or swap labels on the current issue or PR. A label that is not present is skipped on removal.'
+
+inputs:
+ add:
+ description: 'Newline-separated labels to add.'
+ required: false
+ default: ''
+ remove:
+ description: 'Newline-separated labels to remove. A label that is not present is skipped.'
+ required: false
+ default: ''
+ github-token:
+ description: 'Token used for the label API calls.'
+ required: false
+ default: ${{ github.token }}
+
+runs:
+ using: 'composite'
+ steps:
+ - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
+ env:
+ INPUT_ADD: ${{ inputs.add }}
+ INPUT_REMOVE: ${{ inputs.remove }}
+ with:
+ github-token: ${{ inputs.github-token }}
+ script: |
+ const { owner, repo, number: issue_number } = context.issue;
+ const parse = ( value ) =>
+ ( value || '' ).split( '\n' ).map( ( label ) => label.trim() ).filter( Boolean );
+ const add = parse( process.env.INPUT_ADD );
+ const remove = parse( process.env.INPUT_REMOVE );
+
+ if ( add.length ) {
+ await github.rest.issues.addLabels( { owner, repo, issue_number, labels: add } );
+ }
+
+ for ( const name of remove ) {
+ try {
+ await github.rest.issues.removeLabel( { owner, repo, issue_number, name } );
+ } catch ( error ) {
+ // The label may already be absent; ignore that and rethrow anything else.
+ if ( error.status !== 404 ) {
+ throw error;
+ }
+ }
+ }
diff --git a/.github/workflows/triage-replies.yml b/.github/workflows/triage-replies.yml
index cdba31b64d8..33f406fa04a 100644
--- a/.github/workflows/triage-replies.yml
+++ b/.github/workflows/triage-replies.yml
@@ -129,8 +129,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
+ contents: read
issues: write
steps:
+ - name: Check out the composite action
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
+ with:
+ sparse-checkout: .github/actions
- name: Add reply to fill template
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
@@ -161,13 +166,8 @@ jobs:
**WordPress Environment**\n\n\
Copy and paste the system status report from **WooCommerce > System Status** in WordPress admin."
})
- - name: remove-needs-template-label
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1.3.0
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- labels: 'needs: template'
- - name: add-needs-author-feedback-label
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf #v1.1.3
+ - name: Swap needs template label for author feedback
+ uses: ./.github/actions/manage-labels
with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- labels: 'needs: author feedback'
+ add: 'needs: author feedback'
+ remove: 'needs: template'
diff --git a/.github/workflows/update-feedback-labels.yml b/.github/workflows/update-feedback-labels.yml
index c11a077a117..4c6e940d5dd 100644
--- a/.github/workflows/update-feedback-labels.yml
+++ b/.github/workflows/update-feedback-labels.yml
@@ -14,20 +14,17 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
+ contents: read
issues: write
steps:
- - name: Add has feedback
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf #v1.1.3
+ - name: Check out the composite action
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- labels: 'needs: triage feedback'
- - name: remove needs feedback
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1.3.0
+ sparse-checkout: .github/actions
+ - name: Swap author feedback labels for triage feedback
+ uses: ./.github/actions/manage-labels
with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- labels: 'needs: author feedback'
- - name: remove stale
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1.3.0
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- labels: 'status: stale'
+ add: 'needs: triage feedback'
+ remove: |
+ needs: author feedback
+ status: stale