Skip to content

[ISSUE #2304]🏗️Add RemotingCommand encodeHeader method for Zero Copy🚀 #709

[ISSUE #2304]🏗️Add RemotingCommand encodeHeader method for Zero Copy🚀

[ISSUE #2304]🏗️Add RemotingCommand encodeHeader method for Zero Copy🚀 #709

name: Remove and Add Multiple Labels on Approval
on:
pull_request_target:
types:
- closed
jobs:
remove-labels-on-approve:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Remove multiple labels using github-script
uses: actions/github-script@v7
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
const labelsToRemove = ['waiting-review', 'ready to review']; // Labels to remove
// Get repository and PR context information
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
// Get all labels on the current PR
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
owner,
repo,
issue_number,
});
// Filter the labels that exist on the PR and are in the labelsToRemove list
const existingLabelsToRemove = labels
.filter(label => labelsToRemove.includes(label.name))
.map(label => label.name);
// Remove each label
for (const label of existingLabelsToRemove) {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number,
name: label,
});
console.log(`Label '${label}' has been removed.`);
}
if (existingLabelsToRemove.length === 0) {
console.log('No matching labels found to remove.');
}
// Add new labels
await github.rest.issues.addLabels({
owner,
repo,
issue_number,
labels: ['approved']
});