Skip to content
table

GitHub Action

Update GitHub Project(beta) item status

v0.0.1 Latest version

Update GitHub Project(beta) item status

table

Update GitHub Project(beta) item status

TypeScript action to change GitHub Projects(beta) items status

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Update GitHub Project(beta) item status

uses: kalgurn/update-project-item-status@v0.0.1

Learn more about this action in kalgurn/update-project-item-status

Choose a version

typescript-action status

kalgurn/update-project-item-status

This actions was designed as a complimentary action for the actions/add-to-project. It will allow to change the status(column) on the new GitHub Projects(beta).

Useful as a part of a workflow which creates a new items in a GitHub Projects(beta) so they can be placed in the desired column

Usage

Create a workflow which outputs an itemId for the desired item and specify the required fields.

In the example below the newly created issues with a bug label would be added to a project and then the "Triage" status will be set to the resulted item.

name: Add bugs to bugs project

on:
  issues:
    types:
      - opened

jobs:
  add-to-project:
    name: Add issue to project
    runs-on: ubuntu-latest
    steps:
      - uses: actions/add-to-project@main
        id: addItem
        with:
          project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
          github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
          labeled: bug, needs-triage
          label-operator: OR

      - uses: kalgurn/update-project-item-status@main
        with:
          project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
          github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
          item-id: ${{ steps.addItem.outputs.itemId }}
          status: "Triage"

Inputs

  • project-url (required) is the URL of the GitHub project to add issues to.
    eg: https://github.com/orgs|users//projects/

  • github-token (required) is a personal access token with the repo, write:org and read:org scopes.
    See Creating a PAT and adding it to your repository for more details

  • item-id (required) is an ID of the item which requires a status change.
    Usually obtained through an API

  • status (required) desired status to be set for the item. Must be an existing project status

Creating a PAT and adding it to your repository

Development

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/kalgurn/update-project-item-status
> cd add-to-project
> npm install

Or, use GitHub Codespaces.

See the toolkit documentation for the various packages used in building this action.

Publish to a distribution branch

Actions are run from GitHub repositories, so we check in the packaged action in the "dist/" directory.

> npm run build
> git add lib dist
> git commit -a -m "Build and package"
> git push origin releases/v1

Now, a release can be created from the branch containing the built action.

License

The scripts and documentation in this project are released under the MIT License