-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (80 loc) · 2.61 KB
/
recurring_tasks_annual.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Action to create tasks on a set schedule, from
# https://docs.github.com/en/actions/managing-issues-and-pull-requests/scheduling-issue-creation
name: Annual recurring tickets (July 1)
on:
workflow_dispatch:
schedule:
- cron: 0 1 1 7 *
jobs:
create_issue2:
name: Create helpdesk review ticket
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Recurring ticket
run: |
if [[ $CLOSE_PREVIOUS == true ]]; then
previous_issue_number=$(gh issue list \
--label "$LABELS" \
--search "$TITLE in:title" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue close "$previous_issue_number"
gh issue unpin "$previous_issue_number"
fi
fi
new_issue_url=$(gh issue create \
--title "$TITLE" \
--assignee "$ASSIGNEES" \
--label "$LABELS" \
--body "$BODY")
if [[ $PINNED == true ]]; then
gh issue pin "$new_issue_url"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
LABELS: "maintenance"
TITLE: "ANNUAL: Review helpdesk queries to identify common problems"
BODY: |
(created by `recurring_tasks_annual.yml`)
PINNED: false
CLOSE_PREVIOUS: false
create_issue3:
name: Create ROR update ticket
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: ROR ticket
run: |
if [[ $CLOSE_PREVIOUS == true ]]; then
previous_issue_number=$(gh issue list \
--label "$LABELS" \
--search "$TITLE in:title" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue close "$previous_issue_number"
gh issue unpin "$previous_issue_number"
fi
fi
new_issue_url=$(gh issue create \
--title "$TITLE" \
--assignee "$ASSIGNEES" \
--label "$LABELS" \
--body "$BODY")
if [[ $PINNED == true ]]; then
gh issue pin "$new_issue_url"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
LABELS: "maintenance"
TITLE: "ANNUAL: Send new affiliations to ROR"
BODY: |
(created by `recurring_tasks_annual.yml`)
PINNED: false
CLOSE_PREVIOUS: false