assign-one-project-github-action

授权协议 MIT License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 蔚桐
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

GitHub Action for Assign to One Project

Automatically add an issue or pull request to specific GitHub Project when you create and/or label them. By default, the issues are assigned to the To do column and the pull requests to the In progress one, so make sure you have those columns in your project dashboard. But the workflow allowed you to specify the column name as input, so you can assign the issues/PRs based on a set of conditions to a specific column of a specific project.

Latest features:

  • included issue_comment as trigger for this action.
  • added project pagination for searching 100+ GitHub projects.

Acknowledgment & Motivations

This action has been modified from the original action from masutaka. I needed to fix it as the original docker container would not build. Also I think the GitHub Action syntax changed a bit.

I would like to thank @SunRunAway for adding the labelling functionality and custom column input.

Inputs

project

Required The url of the project to be assigned to.

column_name

The column name of the project, defaults to 'To do' for issues and 'In progress' for pull requests.

Example usage

Examples of action:

Repository project

name: Auto Assign to Project(s)

on:
  issues:
    types: [opened, labeled]
  pull_request:
    types: [opened, labeled]
  issue_comment:
    types: [created]
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  assign_one_project:
    runs-on: ubuntu-latest
    name: Assign to One Project
    steps:
    - name: Assign NEW issues and NEW pull requests to project 2
      uses: srggrs/assign-one-project-github-action@1.2.1
      if: github.event.action == 'opened'
      with:
        project: 'https://github.com/srggrs/assign-one-project-github-action/projects/2'

    - name: Assign issues and pull requests with `bug` label to project 3
      uses: srggrs/assign-one-project-github-action@1.2.1
      if: |
        contains(github.event.issue.labels.*.name, 'bug') ||
        contains(github.event.pull_request.labels.*.name, 'bug')
      with:
        project: 'https://github.com/srggrs/assign-one-project-github-action/projects/3'
        column_name: 'Labeled'

Notes

Be careful of using the conditions above (opened and labeled issues/PRs) because in such workflow, if the issue/PR is opened and labeled at the same time, it will be assigned to both projects!

You can use any combination of conditions. For example, to assign new issues or issues labeled with 'mylabel' to a project column, use:

...

if: |
  github.event_name == 'issues' &&
  (
    github.event.action == 'opened' ||
    contains(github.event.issue.labels.*.name, 'mylabel')
  )
...

Organisation or User project

Generate a token from the Organisation settings or User Settings and add it as a secret in the repository secrets as MY_GITHUB_TOKEN

name: Auto Assign to Project(s)

on:
  issues:
    types: [opened, labeled]
  pull_request_target:
    types: [opened, labeled]
  issue_comment:
    types: [created]
env:
  MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}

jobs:
  assign_one_project:
    runs-on: ubuntu-latest
    name: Assign to One Project
    steps:
    - name: Assign NEW issues and NEW pull requests to project 2
      uses: srggrs/assign-one-project-github-action@1.2.1
      if: github.event.action == 'opened'
      with:
        project: 'https://github.com/srggrs/assign-one-project-github-action/projects/2'

    - name: Assign issues and pull requests with `bug` label to project 3
      uses: srggrs/assign-one-project-github-action@1.2.1
      if: |
        contains(github.event.issue.labels.*.name, 'bug') ||
        contains(github.event.pull_request.labels.*.name, 'bug')
      with:
        project: 'https://github.com/srggrs/assign-one-project-github-action/projects/3'
        column_name: 'Labeled'

Change Log

Please refer to the list of changes here

 相关资料
  • Table of Contents assign counter cycle debug eval fetch html_checkboxes html_image html_options html_radios html_select_date html_select_time html_table math mailto popup_init popup textformat Smarty

  • Returns an ObjectLikeSequence whose elements are the combination of this sequence and another object. In the case of a key appearing in both this sequence and the given object, the other object's valu

  • 概要 <#assign name1=value1 name2=value2 ... nameN=valueN> 或 <#assign same as above... in namespacehash> 或 <#assign name> capture this </#assign> 或 <#assign name in namespacehash> capture this </#ass

  • react-assign 不需要任何引用就可以更新 ReactJS 状态。react-assign 是轻量级 React 类状态更新快捷方式,不需要专门定义一个函数处理器。 常规更新: var React = require('react');  React.createClass({    getInitialState() {      return {        username: ""

  • void assign(mixed var) void assign(string varname, mixed var) This is used to assign values to the templates. You can explicitly pass name/value pairs, or associative arrays containing the name/value

  • 请参考:http://www.kancloud.cn/manual/thinkphp/1815