feat: automatic project management #16
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: Configurar Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '14' | |
- name: Instalar Dependências | |
run: npm install @octokit/rest | |
- name: Consultar Projeto | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.ISSUES }} | |
script: | | |
const { Octokit } = require("@octokit/rest"); | |
const octokit = new Octokit({ | |
auth: ${{ secrets.ISSUES }} | |
}); | |
try { | |
const response = await octokit.request('GET /projects/{project_id}', { | |
project_id: 2, | |
headers: { | |
'X-GitHub-Api-Version': '2022-11-28' | |
} | |
}); | |
console.log(response.data); | |
} catch (error) { | |
console.error('Erro ao consultar projeto:', error.message); | |
process.exit(1); | |
} |