-
-
Notifications
You must be signed in to change notification settings - Fork 38
28 lines (25 loc) · 1.05 KB
/
label-remover.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
name: Label remover
on:
# Run workflow when commits are added to PR or when the PR is labeled
pull_request_target:
types: [ synchronize, labeled ]
jobs:
remove-label:
runs-on: ubuntu-latest
steps:
# We remove the label when a commit is added and it has the 'safe to build' label
- name: Remove label
if: github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'safe to build')
run: |
curl --silent --fail \
-X DELETE \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: token ${{ github.token }}' \
'https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/safe%20to%20build'
# Fail workflow to indicate that the PR has not been built because of new commits
- name: Fail workflow
if: github.event.action == 'synchronize'
uses: actions/github-script@v3
with:
script: |
core.setFailed('PR was not marked with "safe to build" label')