A composite GitHub action that updates or gets an item's fields on a GitHub Projects (beta) board based on a workflow dispatch (or other) event's input.
- To make it easier to update/read the fields of a GitHub Project board based on action taken elsewhere within the development process (e.g., status update comments)
- Keep it simple - Prefer boring technology that others can understand, modify, and contribute to
- Never force a human to do what a robot can
Used to automate non-production workflows.
To use this composite GitHub Action, add the following to a YAML file in your repository's .github/workflows/ directory, customizing the with section following the instructions in the Inputs section below:
name: Update status on project board
on:
repository_dispatch:
types: [status_update]
jobs:
update_project:
runs-on: ubuntu-latest
steps:
- name: Read status
id: read_status
uses: github/update-project-action@v3
with:
github_token: ${{ secrets.STATUS_UPDATE_TOKEN }}
organization: github
project_number: 1234
operation: read
content_id: ${{ github.event.client_payload.command.resource.id }}
- name: Output status
run: |
echo "Current status value: ${{ steps.read_status.outputs.field_read_value }}"
- name: Update status
id: update_status
uses: github/update-project-action@v3
with:
github_token: ${{ secrets.STATUS_UPDATE_TOKEN }}
organization: github
project_number: 1234
content_id: ${{ github.event.client_payload.command.resource.id }}
field: Status
value: ${{ github.event.client_payload.data.status }}
- name: Clear due date
id: clear_due_date
uses: github/update-project-action@v3
with:
github_token: ${{ secrets.STATUS_UPDATE_TOKEN }}
organization: github
project_number: 1234
content_id: ${{ github.event.client_payload.command.resource.id }}
field: "Due Date"
operation: clearNote: The above step can be repeated multiple times in a given job to update multiple fields on the same or different projects.
The Action is largely feature complete with regards to its initial goals. Find a bug or have a feature request? Open an issue, or better yet, submit a pull request - contribution welcome!
content_id- The global ID of the issue or pull request within the projectfield- The field on the project to set the value ofgithub_token- A GitHub Token with access to both the source issue and the destination project (repoandwrite:orgscopes)operation- Operation type (update, read, or clear)organization- The organization that contains the project, defaults to the current repository ownerproject_number- The project number from the project's URLvalue- The value to set the project field to. Only required for operation typeupdate; not required forreadorclear.
field_id- The global ID of the fieldfield_read_value- The value of the field before the updatefield_type- The updated field's ProjectV2FieldType (text, single_select, number, date, or iteration)field_updated_value- The value of the field after the updateitem_id- The global ID of the issue or pull requestitem_title- The title of the issue or pull requestoption_id- The global ID of the selected optionproject_id- The global ID of the project
In June 2022, GitHub announced a breaking change to the Projects API. As such, the @v1 tag of this action will ceased working on October 1st, 2022. You can upgrade to the @v2 tag (by updating the reference in your Workflow file) at any time.