-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (92 loc) · 3.17 KB
/
ISSUE_CREATION_WORKFLOW.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# This workflow uses actions that are not certified by GitHub.
# São fornecidas por terceiros e regidas por
# termos de serviço, política de privacidade e suporte separados
# documentação.
name: Weekly Team Sync
# on:
# workflow_dispatch:
# inputs:
# input:
# description: "Criação de issue"
# required: false
# default: "Issue criada"
# schedule:
# - cron: 30 22 * * 2
env:
MONTH_01: "Janeiro"
MONTH_02: "Fevereiro"
MONTH_03: "Março"
MONTH_04: "Abril"
MONTH_05: "Maio"
MONTH_06: "Junho"
MONTH_07: "Julho"
MONTH_08: "Agosto"
MONTH_09: "Setembro"
MONTH_10: "Outubro"
MONTH_11: "Novembro"
MONTH_12: "Dezembro"
# Change this variable for changing the meeting weekday
DATE_WEEKDAY: "wednesday"
# Change this variable for changing the meeting interval
INTERVAL: "14 days"
FIRST_RUN_DATE: "2024-02-13"
jobs:
weekindex:
runs-on: ubuntu-latest
outputs:
weekindex: ${{ steps.calculate.outputs.weekindex }}
steps:
- name: Calculate weekdiff
id: calculate
run: |
current_date=$(date +%Y-%m-%d)
start=$(date -d ${{ env.FIRST_RUN_DATE }} +%s)
end=$(date -d $current_date +%s)
weekdiff=$(((end-start) / 60 / 60 / 24 / 7))
weekindex=$((weekdiff % 2))
echo "weekindex=$weekindex" >> "$GITHUB_OUTPUT"
echo "FIRST_RUN_DATE: ${{ env.FIRST_RUN_DATE }}" >> $GITHUB_STEP_SUMMARY
echo "current_date: $current_date" >> $GITHUB_STEP_SUMMARY
echo "weekdiff: $weekdiff" >> $GITHUB_STEP_SUMMARY
echo "weekindex: $weekindex" >> $GITHUB_STEP_SUMMARY
if [ $weekindex -eq 0 ]; then
echo "🟢 It's the first week of the bi-weekly cycle. The action is going to run." >> $GITHUB_STEP_SUMMARY
else
echo "🔴 It's the second week of the bi-weekly cycle. The action is going to be skipped." >> $GITHUB_STEP_SUMMARY
fi
create_issue:
if: ${{ needs.weekindex.outputs.weekindex == 0 }}
name: Create team sync issue
runs-on: ubuntu-latest
needs:
- weekindex
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
issues: write
steps:
- name: Extract issue template and generate title
uses: imjohnbo/extract-issue-template-fields@v1
id: extract
with:
path: .github/ISSUE_TEMPLATE/reuniao.md
- name: Get meeting date
id: date
run: |
day=$(date -d "$INTERVAL" +%d)
month_num=$(date -d "$INTERVAL" +%m)
month_var="MONTH_$month_num"
month=$(eval echo ${!month_var})
year=$(date -d "$INTERVAL" +%Y)
meeting_date="$day de $month de $year"
echo "::set-output name=date::$meeting_date"
- name: Create meeting issue
uses: imjohnbo/issue-bot@v3
with:
assignees: ${{ steps.extract.outputs.assignees }}
labels: ${{ steps.extract.outputs.labels }}
title: "[Reunião] Geral: ${{ steps.date.outputs.date }}"
body: ${{ steps.extract.outputs.body }}
project: ${{ steps.extract.outputs.project }}
pinned: false
close-previous: false