-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.yml
66 lines (56 loc) · 2.12 KB
/
main.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
name: "PR Checker"
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
validate-and-comment:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout code from PR (Safe Checkout)
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Validate PR
uses: thehanimo/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
remote_configuration_path: "https://raw.githubusercontent.com/leoviana00/GitContributionOpenSource/main/.github/pr-title-checker-config.json"
- name: Comment PR on Success and Add Label [automerge]
if: success()
run: |
AUTHOR_NAME=${{ github.event.pull_request.user.login }}
cat <<EOT > message.txt
Aí sim hein $AUTHOR_NAME ! Seu PR foi aprovado 🥳
Faremos o merge aqui em breve. Muito obrigado pela contribuição 🚀
EOT
gh pr comment ${{ github.event.pull_request.number }} --body-file=message.txt
gh pr edit ${{ github.event.pull_request.number }} --add-label "automerge"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment PR on Failure
if: failure()
run: |
AUTHOR_NAME=${{ github.event.pull_request.user.login }}
cat <<EOT > message.txt
Olá $AUTHOR_NAME ! Parece que houve um problema com o seu PR 🧐 Aqui estão algumas coisas para verificar:
- Seu PR deve seguir a [convenção de commits](https://www.conventionalcommits.org/pt-br/v1.0.0-beta.4/).
Agradecemos sua contribuição e compreensão 👊😉
EOT
gh pr comment ${{ github.event.pull_request.number }} --body-file=message.txt
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
automerge:
runs-on: ubuntu-latest
needs: validate-and-comment
permissions:
contents: write
steps:
- id: automerge
name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"