Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature pr title #41

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/pr-title-checker-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"LABEL": {
"name": "titulo está fora do padrão",
"color": "FF0000"
},
"CHECKS": {
"prefixes": [
"fix: ",
"feat: ",
"test: ",
"style: ",
"revert: ",
"refactor: ",
"perf: ",
"docs: ",
"ci:",
"chore: ",
"build: "

],
"regexp": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([a-z-0-9]+\\))?: [\\w-\\[\\] ]+$"
},
"MESSAGES": {
"success": "Tudo OK",
"failure": "Problema com o padrão do commit",
"notice": ""
}
}
16 changes: 14 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2


- name: Checkout code from PR (Safe Checkout)
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Validate PR
uses: thehanimo/pr-title-checker@v1.4.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
remote_configuration_path: "https://raw.githubusercontent.com/leoviana00/lab-k8s-prep-cks/main/.github/pr-title-checker-config.json"

# - uses: actions/checkout@v2

- name: Issue Validator
uses: HarshCasper/validate-issues-over-pull-requests@v0.1.1
id: validator
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

**11**
**2**
66 changes: 66 additions & 0 deletions main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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/pr-title-checker@v1.4.1
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/automerge-action@v0.16.3"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Loading