Skip to content

Commit

Permalink
remove the PRT labels for new commits
Browse files Browse the repository at this point in the history
  • Loading branch information
omkarkhatavkar committed Feb 15, 2024
1 parent 57db84f commit 74bd08f
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,43 @@ jobs:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: get the PRT status, it will be empty incase of new commit
id: status
uses: omkarkhatavkar/wait-for-status-checks@main
with:
ref: ${{ github.head_ref }}
context: 'Robottelo-Runner'
wait-interval: 60
count: 100

- name: remove the PRT Passed/Failed label for new commit
if: ${{steps.status.outputs.result}} == 'not found'
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
const prNumber = ${{ github.event.inputs.pr_number }};
const issue = await github.rest.issues.get({
owner: github.context.repo.owner, // Owner of the repository
repo: github.context.repo.repo, // Repository name
issue_number: prNumber, // Pull request number
});
const labelsToRemove = ['PRT-Failed', 'PRT-Passed']; // Labels to be removed
const labelsToRemoveFiltered = labelsToRemove.filter(label =>
issue.data.labels.some(({ name }) => name === label)
); // Filter out labels present on the pull request that match labelsToRemove
if (labelsToRemoveFiltered.length > 0) { // If there are labels to remove
await Promise.all(labelsToRemoveFiltered.map(async label => {
await github.rest.issues.removeLabel({
issue_number: prNumber, // Pull request number
owner: github.context.repo.owner, // Owner of the repository
repo: github.context.repo.repo, // Repository name
name: label // Name of the label to remove
});
}));
}
- name: Checkout Robottelo
uses: actions/checkout@v4

Expand Down

0 comments on commit 74bd08f

Please sign in to comment.