Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/setup-project-board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Setup Project Board
on:
workflow_dispatch:

permissions:
repository-projects: write

jobs:
setup-board:
runs-on: ubuntu-latest
steps:
- name: Create project board with columns
uses: actions/github-script@v7
with:
script: |
const columns = [
'Backlog',
'Ready for Agent',
'In Progress',
'Review',
'Done'
];

// Check for an existing board named 'Board'
const { data: existingProjects } = await github.rest.projects.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});

let project;
const existing = existingProjects.find(p => p.name === 'Board');
if (existing) {
console.log(`Using existing project: ${existing.name} (id: ${existing.id})`);
project = existing;
} else {
const created = await github.rest.projects.createForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'Board',
});
console.log(`Created project: ${created.data.name} (id: ${created.data.id})`);
project = created.data;
}

// Add columns in order, skipping any that already exist
const { data: existingColumns } = await github.rest.projects.listColumns({
project_id: project.id,
});
const existingNames = new Set(existingColumns.map(c => c.name));

for (const name of columns) {
if (existingNames.has(name)) {
console.log(`Column already exists, skipping: ${name}`);
continue;
}
try {
await github.rest.projects.createColumn({
project_id: project.id,
name,
});
console.log(`Created column: ${name}`);
} catch (err) {
core.setFailed(`Failed to create column "${name}": ${err.message}`);
return;
}
}