Skip to content

Update push_event.yml #7

Update push_event.yml

Update push_event.yml #7

Workflow file for this run

# running specific actions related to push events
name: Remove PRT labels for new commit
on:
push:
jobs:
remove-prt-labels:
name: Remove PRT labels for new commit
runs-on: ubuntu-latest
steps:
- name: Remove the previous PRT Result labels
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
const prNumber = github.context.payload.pull_request.number;
const issue = await github.rest.issues.get({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
issue_number: prNumber,
});
const labelsToRemove = ['PRT-Failed', 'PRT-Passed'];
const labelsToRemoveFiltered = labelsToRemove.filter(label => issue.data.labels.some(({ name }) => name === label));
if (labelsToRemoveFiltered.length > 0) {
await Promise.all(labelsToRemoveFiltered.map(async label => {
await github.rest.issues.removeLabel({
issue_number: prNumber,
owner: github.context.repo.owner,
repo: github.context.repo.repo,
name: label
});
}));
}