Use this action to automatically update GitHub project (beta) item fields. Note that this action does not support GitHub projects (classic).
The main difference between this lib and others is that you can use a PAT with repo and project scopes instead of org scope.
See action.yml for metadata that defines the inputs, outputs, and runs configuration for this action.
For more information about workflows, see Using workflows.
Create a workflow that will be triggered on Issues or Pull Requests events. It is highly recommended to use add-to-project action before in order to find/create an item in your project and then send the itemId as input to update-project-fields
.
Once you've configured your workflow, save it as a .yml
file in your target Repository's .github/workflows
directory.
name: Create and/or Update edited issues to my project
on:
issues:
types:
- edited
jobs:
create-update-project:
name: Create/update project issue
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/add-to-project@v0.3.0 # This adds the issue to the project
with:
project-url: https://github.com/users/titoportas/projects/2
github-token: ${{ secrets.GHPROJECT_SECRET }}
id: add-project
- uses: titoportas/update-project-fields@v0.1.0
with:
project-url: https://github.com/users/titoportas/projects/2
github-token: ${{ secrets.GHPROJECT_SECRET }}
item-id: ${{ steps.add-project.outputs.itemId }} # Use the item-id output of the previous step
field-keys: TextField,NumberField,FinishedAt,Size,IterationField
field-values: foo,123,2022-09-01,🐋 X-Large,[1]
project-url
(required) is the URL of the GitHub project to add issues to. eg:https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
github-token
(required) is a personal access token withrepo
andproject
scopes. See Creating a PAT and adding it to your repository for more detailsitem-id
(required) project item id to be updated. Important: this id is not the issue/pull_request number.field-keys
(required) the github project field names separated with,
.field-values
(required) the github project field values associated to thefield-keys
separated with,
. If the key has values with special characters (eg: ✅ Done) you must include them.
-
create a new personal access token with
repo
andproject
scopes See Creating a personal access token for more information -
add the newly created PAT as a repository secret, this secret will be referenced by the github-token input See Encrypted secrets for more information
To get started contributing to this project, clone it and install dependencies. Note that this action runs in Node.js 16.x, so we recommend using that version of Node (see "engines" in this action's package.json for details).
> git clone https://github.com/titoportas/update-project-fields.git
> cd update-project-fields
> npm install
The scripts and documentation in this project are released under the MIT License
I want to say thanks to the authors and contributors of add-to-project and project-update. This Github action is based on both github projects.