Giter Club home page Giter Club logo

project-update's Introduction

Update Item Field Projects (BETA) ✏️

This GitHub action updates item fields on Projects (beta).

The action is great to use in combination with project-add as you will need to obtain the item-id to update an item's field.

Field Type Support

  • Text
  • Number
  • Date
  • Single select
  • Iteration

field-names are supplied as a CSV list of names.

          field-names: Status,Iteration,product,priority

field-values are supplied as a CSV list of corresponding values.

          field-values: todo,[0],back-end,high

Options and iterations are matched by the name(case-insensitive). You can also use an array index notation. For example [0] would be the first option or iteration. The first iteration is always the current one.

Usage

Create a workflow (eg: .github/workflows/on-issue-pr-open.yml). See Creating a Workflow file.

You will need a project number for input project-number. For example https://github.com/users/austenstone/projects/5 the project number is 5.

You will need to create a PAT(Personal Access Token) that has admin:org access so we can read/write to the project.

Add this PAT as a secret so we can use it as input github-token, see Creating encrypted secrets for a repository.

Organizations

If your project is part of an organization that has SAML enabled you must authorize the PAT, see Authorizing a personal access token for use with SAML single sign-on.

Example: Add Issues and PRs

name: "Add Issue/PR to Project"
on:
  issues:
    types: [opened]
  pull_request:
    types: [opened]

jobs:
  add_to_project:
    name: Add to Project
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: austenstone/project-add@main
        with:
          user: ${{ github.repository_owner }}
          project-number: 5
          github-token: "${{ secrets.MY_TOKEN }}"
        id: project-add
      - uses: austenstone/project-update@main
        with:
          user: ${{ github.repository_owner }}
          project-number: 5
          github-token: "${{ secrets.MY_TOKEN }}"
          item-id: ${{ steps.project-add.outputs.id }}
          field-names: product,priority
          field-values: back-end,high

Users

For user owned projects you must provide the user input in the workflow.

        with:
          user: ${{ github.repository_owner }}
          github-token: "${{ secrets.MY_TOKEN }}"
          project-number: 1234

Input Settings

Various inputs are defined in action.yml:

Name Description Default
project-number The project number. Get this from the URL. N/A
github-token Token to use to authorize. This should be a personal access token. ${{ github.token }}
organization The organization that owns of the project. the repository owner
user The user that owns of the project. N/A
item-id The item Id of the issue or pull request. N/A
field-names CSV fields to modify. N/A
field-values CSV fields values. N/A

If you are using a user owned project board you must provide the user input.
${{ github.repository_owner }} is fine if you're the owner of the repository.

Permissions

Until GitHub supports permissions for projects (beta) we will need to create a PAT(Personal Access Token) with admin:org scope.

Once support is added you we can utilize Assigning permissions to jobs and the action will default to the token ${{ github.token }}.

permissions:
  repository-projects: write

Another option is to use something like tibdex/github-app-token to get a token during the workflow.

References

project-update's People

Contributors

austenstone avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.