Action to move issues / PRs between project columns with some conditions
Features:
- 🚀 Super-fast with Github Graphql and restful APIs
- ✨ Flexible use cases with our Instructor Query
- 🏭 A part of ABux standard process (guideline coming soon)
Table of contents:
See action.yml
Here is an example setup using this action, which required params. Details on params are shown on Params section:
...
steps:
- uses: hungluu/move-tasks@v3
with:
actionToken: <action-token>
project: <project>
repository: <repository>
fromCards: >
$project
> columns(name oneOf To, In progress)
> cards
toColumn: $project > columns(name is Done)
type: string
This is Github token with permission on Issues & Projects, which can be acquired from Personal access tokens
type: string
Repository identifier, requires user / organization along (with examples)
- user name/repo name (
hungluu/move-tasks
) - org name/repo name (
abux/labs
)
type: number | string
This can be project's id (number), name (string) for user / organization projects or even projects that belong to specific repository (with examples):
- project id (
1
) - project name (
Blocks
or a partial likeBlo
) - repo's project id (
hungluu/move-tasks/1
) - repo's project name (
hungluu/move-tasks/Blocks
)
type: string
This use instructor query query to retrive cards (definition) for moving into column
Example 1 Move all cards from both columns named In progress
and To do
:
fromCards: >
$project
> columns(name oneOf To, In progress)
> cards
Example 2 Move only cards belonging to closed issues:
fromCards: >
$project
> columns
> cards(contentState is closed)
Example 3 Move only cards belonging to pull requests:
fromCards: >
$project
> columns
> cards(contentType is Pull Request)
Example 4 Move only cards with specific users (for example hungluu
and tranquocthoai
):
fromCards: >
$project
> columns
> cards(author oneOf hungluu, tranquocthoai)
type: string
This use instructor query query to retrive a column (definition)
Example 1 Column named Done
:
toColumn: >
$project
> columns(name is Done)
Example 2 Column with issue number (the number displayed on Issue, for example #1
) from event context:
toColumn: >
$project
> columns(contentNumber is ${{ github.context.issue.number }})
Enable flexible approaches to retrieve resources based on query definitions from data sources (customizable to each project) (More information)
$dataSource.layer(field filter values)
Format break-down:
-
$dataSource For this particular action, available data sources are:
$project
Everything about project info, columns and cards$context
To access action github context (For example$context
)
-
layer A part / path from data source. for example this is the action's current layer structure:
$project { columns [ ... { cards: [...] } ] }
-
field Depends on layer's data, there are fields we can filter through conditions, for example columns' fields definition:
id
Column idname
Column name
-
filter Filters indicate what types of condition should be applied to field. For this project they are:
oneOf <values>
Field is one of the provided values (For examplecolumns(name oneOf Done, Released)
)is <value>
Check field value (For examplecards(contentAuthor is hungluu)
)in <list>
Check field value exists on another list (For examplecards(contentAuthor in $context.repo.owner)
)has
Check if field is a list which contains particular value (For examplecards(labels has release, wip)
)hasText
check if field is a string which contains a word / text (For examplecards(name hasText abc)
) (This filter is case insensitive)matches
check if field is a string which matches regex (For examplecards(name matches /abc/i)
)
export interface IProjectCard {
id: number
contentId: number
contentNumber: number // issue or PR number, displayed on UI, for example #14
contentTitle: string
contentType: string
contentCreatedAt: string
contentAuthor: string
contentState: string
// { assigneeId: assigneeName }
contentAssignees: {[key: string]: string}
// { labelId: labelName }
contentLabels: {[key: string]: string}
}
export interface IProjectColumn {
id: number
name: string
cards: IProjectCard[]
}
All contributions are welcomed. Feel free to clone this project, make changes that your feel necessary and pull request anytime you want.
Install dependencies
yarn install
Run development build
yarn start
If you have any other suggestions, you can even open new issues with enhancement
label.
🍺