-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (43 loc) · 2.4 KB
/
notification-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
name: Update NOTIFICATION v2
on:
push:
branches:
- master
schedule:
- cron: "0 * * * *"
jobs:
update_notification:
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt-get install -y jq
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js 14
uses: actions/setup-node@v3
with:
node-version: 14
- name: Set up Git
run: |
git config --global user.email "github-actions@github.com"
git config --global user.name "GitHub Actions"
- name: Pegar e formatar dados
run: |
issues=$(curl --request GET \
--url https://api.github.com/repos/maiconrp/AD-gestao/issues?state=open \
--header "content-type: application/json" \
--header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq '.[] | "|"+.labels[0].name +"|"+ .user.login +"|"+ "[" + .title +"]" + "(" + .html_url + ")" +"|"+ .created_at +"|"+.updated_at' | sed -e 's/\"//g' | head -n 5)
pull_requests=$(curl --request GET \
--url https://api.github.com/repos/maiconrp/AD-gestao/pulls \
--header "content-type: application/json" \
--header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq '.[] | .user.login + ": " + .title +"\n" ' | sed -e 's/\"//g' | head -n 5)
commits=$(curl --request GET \
--url https://api.github.com/repos/maiconrp/AD-gestao/commits?state=open \
--header "content-type: application/json" \
--header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq '.[] | "|" + .commit.author.name + "|" + "["+.commit.message+"]"+"("+.html_url+")" + "|" + .commit.author.date' | sed -e 's/\"//g' | head -n 5)
issue_template="### Issues:\n|Label|Autor|Titulo|Criada|Atualizada|\n|-----|-----|------|------|----------|\n$issues\n\n\n"
pullrequest_template="### PRs:\n|Autor|Titulo|\n|-----|------|\n$pull_requests\n\n\n"
commit_template="### Commits:\n|Autor|Mensagem|Data|\n|-----|--------|----|\n$commits"
notification_template="# Notificações\n\n$issue_template $pullrequest_template $commit_template"
echo -e "$notification_template" > NOTIFICATION.md
git diff --quiet || git commit -am "🔧 Update NOTIFICATION with issues" && git push