workflows/eval: Clear unnecessary rebuild labels (#360277)
This commit is contained in:
commit
e012442a7e
30
.github/workflows/eval.yml
vendored
30
.github/workflows/eval.yml
vendored
@ -237,9 +237,33 @@ jobs:
|
|||||||
|
|
||||||
- name: Tagging pull request
|
- name: Tagging pull request
|
||||||
run: |
|
run: |
|
||||||
|
# Get all currently set rebuild labels
|
||||||
gh api \
|
gh api \
|
||||||
--method POST \
|
/repos/"$REPOSITORY"/issues/"$NUMBER"/labels \
|
||||||
/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels \
|
--jq '.[].name | select(startswith("10.rebuild"))' \
|
||||||
--input <(jq -c '{ labels: .labels }' comparison/changed-paths.json)
|
| sort > before
|
||||||
|
|
||||||
|
# And the labels that should be there
|
||||||
|
jq -r '.labels[]' comparison/changed-paths.json \
|
||||||
|
| sort > after
|
||||||
|
|
||||||
|
# Remove the ones not needed anymore
|
||||||
|
while read -r toRemove; do
|
||||||
|
echo "Removing label $toRemove"
|
||||||
|
gh api \
|
||||||
|
--method DELETE \
|
||||||
|
/repos/"$REPOSITORY"/issues/"$NUMBER"/labels/"$toRemove"
|
||||||
|
done < <(comm -23 before after)
|
||||||
|
|
||||||
|
# And add the ones that aren't set already
|
||||||
|
while read -r toAdd; do
|
||||||
|
echo "Adding label $toAdd"
|
||||||
|
gh api \
|
||||||
|
--method POST \
|
||||||
|
/repos/"$REPOSITORY"/issues/"$NUMBER"/labels \
|
||||||
|
-f "labels[]=$toAdd"
|
||||||
|
done < <(comm -13 before after)
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
NUMBER: ${{ github.event.number }}
|
||||||
|
Loading…
Reference in New Issue
Block a user