[FEATURE]: Múltiplos ips para o cluster #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Community Management | |
| on: | |
| issues: | |
| types: [opened] | |
| pull_request: | |
| types: [opened] | |
| discussion: | |
| types: [created] | |
| # Manual trigger | |
| workflow_dispatch: | |
| jobs: | |
| welcome-new-contributors: | |
| name: Welcome New Contributors | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'issues' || github.event_name == 'pull_request' || github.event_name == 'discussion' | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| discussions: write | |
| steps: | |
| - name: Check if first-time contributor | |
| id: check-contributor | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const author = context.payload.sender.login; | |
| try { | |
| // Check if user has previous contributions | |
| const { data: issues } = await github.rest.search.issuesAndPullRequests({ | |
| q: `repo:${owner}/${repo} author:${author} type:issue`, | |
| per_page: 1 | |
| }); | |
| const { data: prs } = await github.rest.search.issuesAndPullRequests({ | |
| q: `repo:${owner}/${repo} author:${author} type:pr`, | |
| per_page: 1 | |
| }); | |
| const isFirstTime = issues.total_count === 0 && prs.total_count === 0; | |
| if (context.eventName === 'issues' && issues.total_count <= 1) { | |
| core.setOutput('is-first-issue', true); | |
| } | |
| if (context.eventName === 'pull_request' && prs.total_count <= 1) { | |
| core.setOutput('is-first-pr', true); | |
| } | |
| core.setOutput('is-first-time', isFirstTime); | |
| core.setOutput('author', author); | |
| } catch (error) { | |
| core.setOutput('is-first-time', false); | |
| core.setOutput('author', author); | |
| } | |
| - name: Welcome new issue contributor | |
| if: steps.check-contributor.outputs.is-first-issue == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const welcomeMessage = `👋 Bem vindo ao projeto do homelab, @${{ steps.check-contributor.outputs.author }}! | |
| Obrigado por abrir a sua primeira issue. Sua contribuição para a comunidade é sempre bem-vinda! | |
| **Próximos passos?** | |
| - Os mantenedores do projeto irão revisar a sua issue | |
| - Caso esteja reportando um problema, não esqueça de incluir os passos para reproduzir o problema | |
| - Mas caso esteja adicionando uma requisição de funcionalidade, discutiremos como abordar a implamentação | |
| **Envolva-se com a comunidade:** | |
| - Leia o guia [Guia de Contribuição](../../blob/main/CONTRIBUTING.md) | |
| - Participe das nossas discussões com idéias e perguntas | |
| - Procure por issue com a label \`good first issue\` caso você deseje contribuir com código | |
| Novamente agradecemos por fazer parte da nossa comunidade! 🚀`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: welcomeMessage | |
| }); | |
| - name: Welcome new PR contributor | |
| if: steps.check-contributor.outputs.is-first-pr == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const welcomeMessage = `🎉 Obrigado por enviar o seu primeiro pull request, @${{ steps.check-contributor.outputs.author }}! | |
| Estamos muito contente em ter você contribuindo com o projeto! | |
| **Processo de revisão:** | |
| - OS mantenedores irão revisar as suas atualizações | |
| - Podemos requisitar alterações ou fazer algumas perguntas em relação sua mudanças | |
| - Uma vez aprovada, a sua contribuição será in corporada no ramo principal (main branch) | |
| **Algumas dicas:** | |
| - Tenha certeza que o seu PR descreve com clareza das suas atualizações | |
| - Inclua testes se aplicavél | |
| - Mantenha as suas atualizações focadas e atômicas | |
| **Enquando espera pela revisão:** | |
| - Verifique se existe outra issue aberta na qual gostaria de trabalhar | |
| - Envie perguntas e idéias relativos ao projeto | |
| - Revise nosso [Guia de Contribuição](../../blob/main/CONTRIBUTING.md) | |
| Obrigado pelas sua contribuição para melhorar o projeto! 🙌`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| body: welcomeMessage | |
| }); | |
| auto-tag: | |
| name: Auto Tag Issues and PRs | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'issues' || github.event_name == 'pull_request' | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - name: Auto-tag issues and PRs | |
| uses: actions/github-script@v7 | |
| env: | |
| GITHUB-TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const isIssue = context.eventName === 'issues'; | |
| const isPR = context.eventName === 'pull_request'; | |
| const item = isIssue ? context.payload.issue : context.payload.pull_request; | |
| const title = item.title.toLowerCase(); | |
| const body = (item.body || '').toLowerCase(); | |
| const content = `${title} ${body}`; | |
| const labels = []; | |
| // Type-based labels | |
| if (isIssue) { | |
| if (content.includes('bug') || content.includes('erro') || content.includes('quebra*')) { | |
| labels.push('bug'); | |
| } else if (content.includes('funcionalidade') || content.includes('melhoria') || content.includes('improvement')) { | |
| labels.push('enhancement'); | |
| } else if (content.includes('pergunta') || content.includes('ajuda') || content.includes('how to')) { | |
| labels.push('question'); | |
| } else if (content.includes('documentation') || content.includes('doc*') || content.includes('readme')) { | |
| labels.push('documentation'); | |
| } | |
| } | |
| if (isPR) { | |
| labels.push('pr'); | |
| if (content.includes('fix') || content.includes('bug')) { | |
| labels.push('bugfix'); | |
| } else if (content.includes('feature') || content.includes('add') || content.includes('new')) { | |
| labels.push('feature'); | |
| } else if (content.includes('refactor') || content.includes('cleanup')) { | |
| labels.push('refactoring'); | |
| } else if (content.includes('doc') || content.includes('readme')) { | |
| labels.push('documentation'); | |
| } | |
| } | |
| // Priority labels | |
| if (content.includes('urgent') || content.includes('critical') || content.includes('blocking')) { | |
| labels.push('priority: high'); | |
| } else if (content.includes('minor') || content.includes('trivial')) { | |
| labels.push('priority: low'); | |
| } | |
| // Component labels based on file paths or content | |
| if (content.includes('docker') || content.includes('container')) { | |
| labels.push('docker'); | |
| } | |
| if (content.includes('workflow') || content.includes('github action') || content.includes('ci/cd')) { | |
| labels.push('ci/cd'); | |
| } | |
| if (content.includes('security') || content.includes('vulnerability')) { | |
| labels.push('security'); | |
| } | |
| if (content.includes('performance') || content.includes('optimization')) { | |
| labels.push('performance'); | |
| } | |
| // Apply labels if any were determined | |
| if (labels.length > 0) { | |
| await github.rest.issues.addLabels({ | |
| owner, | |
| repo, | |
| issue_number: item.number, | |
| labels | |
| }); | |
| } |