Skip to content

Updates an item on a GitHub Projects (beta) board based on a workflow dispatch (or other) event's input.

License

Notifications You must be signed in to change notification settings

3drepo/update-project-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Update Project Action

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.

CI

Goals

  • 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

Status

Used to automate non-production workflows.

Usage

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@v2
        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@v2
        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 }}

Note: The above step can be repeated multiple times in a given job to update multiple fields on the same or different projects.

Roadmap

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!

Inputs

  • content_id - The global ID of the issue or pull request within the project
  • field - The field on the project to set the value of
  • github_token - A GitHub Token with access to both the source issue and the destination project (repo and write:org scopes)
  • organization - The organization that contains the project, defaults to the current repository owner
  • project_number - The project number from the project's URL
  • value - The value to set the project field to
  • operation - Type of the operation (update or read; default is update)

Outputs

  • field_read_value - The value of the field before the update
  • field_updated_value - The value of the field after the update (in case of read operation equals to field_read_value)
  • field_id - The global ID of the field
  • field_type - The updated field's ProjectV2FieldType (text, single_select, number, date, or iteration)
  • item_id - The global ID of the issue or pull request
  • item_title - The title of the issue or pull request
  • option_id - The global ID of the selected option
  • project_id - The global ID of the project

V1 vs V2

In June 2022, GitHub announced a breaking change to the Projects API. As such, the @v1 tag of this action will cease working on October 1st, 2022. You can upgrade to the @v2 tag (by updating the reference in your Workflow file) at any time.

About

Updates an item on a GitHub Projects (beta) board based on a workflow dispatch (or other) event's input.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 95.0%
  • Shell 5.0%