feat: automatic project management #8
Workflow file for this run
This file contains 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
on: | |
issues: | |
types: | |
- opened | |
push: | |
jobs: | |
issue-assignee: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Assignee | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.ISSUES }} | |
script: | | |
const assignee = 'Robso-creator'; // Substitua pelo nome do responsável | |
const issueNumber = 22; | |
const repo = context.repo.repo; | |
try { | |
// Atribuir o responsável à issue | |
await github.issues.addAssignees({ | |
owner: context.repo.owner, | |
repo: repo, | |
issue_number: issueNumber, | |
assignees: [assignee], | |
}); | |
console.log(`Responsável ${assignee} atribuído à issue #${issueNumber}`); | |
} catch (error) { | |
console.error('Erro ao atribuir responsável à issue:', error.message); | |
process.exit(1); | |
} | |
# | |
# add-to-project: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Configure Issue | |
# uses: actions/github-script@v3 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# script: | | |
# const projectId = '2'; | |
# const columnName = 'Backlog'; // Substitua pelo nome da coluna do seu projeto | |
# const issueNumber = 20; | |
# const repo = context.repo.repo; | |
# | |
# | |
# // Obter lista de projetos no repositório | |
# const projects = await github.projects.listForRepo({ | |
# owner: context.repo.owner, | |
# repo: repo, | |
# }); | |
# | |
# // Encontrar o projeto pelo ID ou nome | |
# const project = projects.data.find(p => p.id === projectId || p.name === projectId); | |
# | |
# if (!project) { | |
# console.error(`Projeto não encontrado com ID ou nome: ${projectId}`); | |
# process.exit(1); | |
# } | |
# | |
# // Encontrar a coluna pelo nome | |
# const projectColumn = project.columns.find(col => col.name === columnName); | |
# | |
# if (!projectColumn) { | |
# console.error(`Coluna não encontrada com o nome: ${columnName}`); | |
# process.exit(1); | |
# } | |
# | |
# // Adicionar à coluna do projeto | |
# await github.projects.moveProjectCard({ | |
# card_id: issue.data.cards[0].id, | |
# position: 'top', | |
# column_id: projectColumn.id, | |
# }); |