-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.41 KB
/
auto-add-to-project.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
name: Auto Add To Project Ushahidi Articles
on:
issues:
types:
- opened
jobs:
process-issue:
runs-on: ubuntu-latest
steps:
- name: Assign issue to creator
uses: actions/github-script@v6
with:
script: |
const issueCreator = context.payload.issue.user.login;
await github.issues.addAssignees({
...context.repo,
issue_number: context.payload.issue.number,
assignees: [issueCreator]
});
- name: Add issue to project
uses: actions/github-script@v6
with:
script: |
const projectName = "Project Ushahidi Articles";
const projects = await github.projects.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
});
const project = projects.data.find(proj => proj.name === projectName);
if (!project) {
throw new Error(`Project "${projectName}" not found`);
}
const columns = await github.projects.listColumns({
project_id: project.id,
});
const column = columns.data[0]; // Add to the first column, adjust as needed
await github.projects.createCard({
column_id: column.id,
content_id: context.payload.issue.id,
content_type: "Issue",
});