-
-
Notifications
You must be signed in to change notification settings - Fork 491
57 lines (52 loc) · 2.32 KB
/
sync_labels.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# This workflow synchronizes groups of labels that correspond
# to items of selection list in Trac. It controls that in each
# such case there is just one label of the list present.
# Furthermore in the case of the state it checks the labels
# to coincide with the corresponding review state.
name: Synchronize labels
on:
issues:
types: [opened, reopened, closed, labeled, unlabeled]
pull_request_review:
types: [submitted]
pull_request_target:
types: [opened, reopened, closed, ready_for_review, converted_to_draft, synchronize, labeled, unlabeled]
schedule:
# run cleaning of warning comments twice a day
- cron: '00 6,18 * * *'
jobs:
synchronize:
if: | # check variables from repository settings to suspend the job
vars.SYNC_LABELS_ACTIVE == 'yes' && (! vars.SYNC_LABELS_IGNORE_EVENTS || ! contains(fromJSON(vars.SYNC_LABELS_IGNORE_EVENTS), github.event.action))
runs-on: ubuntu-latest
steps:
# Checkout the Python script
- name: Checkout files
uses: Bhacaz/checkout-files@v2
with:
files: .github/sync_labels.py
# Perform synchronization
- name: Call script for synchronization
if: github.event.schedule == ''
run: |
chmod a+x .github/sync_labels.py
.github/sync_labels.py $ACTION $ISSUE_URL $PR_URL $ACTOR "$LABEL" "$REV_STATE" $LOG_LEVEL
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTION: ${{ github.event.action }}
ISSUE_URL: ${{ github.event.issue.html_url }}
PR_URL: ${{ github.event.pull_request.html_url }}
ACTOR: ${{ github.actor }}
LABEL: ${{ github.event.label.name }}
REV_STATE: ${{ github.event.review.state }}
LOG_LEVEL: ${{ vars.SYNC_LABELS_LOG_LEVEL }} # variable from repository settings, values can be "--debug", "--info" or "--warning"
# Perform cleaning
- name: Call script for cleaning
if: github.event.schedule != ''
run: |
chmod a+x .github/sync_labels.py
.github/sync_labels.py $REPO_URL $LOG_LEVEL
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_URL: ${{ github.event.repository.html_url }}
LOG_LEVEL: ${{ vars.SYNC_LABELS_LOG_LEVEL }} # variable from repository settings, values can be "--debug", "--info" or "--warning"