-
Notifications
You must be signed in to change notification settings - Fork 500
Description
The documentation at https://github.com/marketplace/actions/github-script is a bit incomplete on basic tasks.
I've worked out most of what I need to do, but one task eludes me ... how do I add an issue to a project?
I can imagine a job like this ...
add-projects:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.addProjects({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
projects: [35]
})
How is it actually done?
Perhaps along the lines of ...
create-card:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.projects.createCard({
column_id: 4248551,
content_id: context.payload.issue.id,
content_type: "Issue"
})
... where 4248551 is the "Triage" column from my project, which is found via the link to the column. Even if close, it's not super clear how it knows the project number. I assume the column_id is unique across projects, and that's how it adds it to the correct project.
However, that approach isn't working. Could it be because the project is a classic GH project, and that code will only work with a late-model project?
Any assistance greatly appreciated!
Here's the workflow that I'm working with. The highlight is the code I show above placed in the process-blazor-issue job ...
https://github.com/dotnet/AspNetCore.Docs/blob/main/.github/workflows/issue-processing.yml#L123-L130
This is the project that I'm trying to add issues to (the Triage column is 4248551) ...
https://github.com/dotnet/AspNetCore.Docs/projects/35
Everything above the last step works fine. This is the only part of the workflow that I can't get working.