Skip to content

Update README.rst

Update README.rst #2

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
if: contains(github.event.pull_request.labels.*.name, 'PRT')
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
if ('${{github.event_name}}' === 'push') {
// Your code to handle the event due to new commit
const prNumber = ${{ github.event.number }};
const issue = await github.rest.issues.get({
owner: context.issue.owner,
repo: context.issue.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: context.repo.owner,
repo: context.repo.repo,
name: label
});
}));
}
}