Skip to content

Auto Add To Project Ushahidi Articles #2

Auto Add To Project Ushahidi Articles

Auto Add To Project Ushahidi Articles #2

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",
});