Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
elglup committed Sep 22, 2021
0 parents commit c2c8d5f
Show file tree
Hide file tree
Showing 10 changed files with 1,592 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2018
},
"plugins": ["prettier"],
"rules": {
"indent": [
"error",
4
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
};
12 changes: 12 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: eslint
on: [pull_request]
jobs:
build:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: eslint
run: |
npm install
npm run-script lint
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Defence Digtial Services

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Move issue action

A GitHub action that moves a labelled or milestoned issue. Cloned from [konradpabjan/move-labeled-or-milestoned-issue](https://github.com/konradpabjan/move-labeled-or-milestoned-issue)

### Demo
This demo shows an issue that has the priority label added automatically get moved from column `New issues should show up here` to `Priority labeled stuff should automatically move here`.

![](demo.gif)

### Use Case
Everytime a specific label is added to an issue (or issue added to a milestone), the associated card in a project should be moved to a specific column. For example, you want any issue that gets labeled with "priority" to automatically move to the column that corresponds to "on deck". If the issue is not on the project board, it will be created in the desired column. If it has already been added, it will be moved to the correct column.

This action can be used for projects that are linked and setup at the org level or repository level. The token that is supplied though must have `repo` permissions. If the project is linked at the org level, it must also have `org:read` permissions.

### Input

| Input | Description |
|---------|---|
| action-token | An access token that will be used to move or create an issue in a desired column. The standard token that is present for each action will not be sufficient as it does not have sufficient privilages. You must create one that has `repo` permissions (see below) |
| project-url | The url of the project. Will be something like `https://github.com/orgs/github/projects/1` or `https://github.com/konradpabjan/example/projects/1` |
| column-name | The name of the column in project that issues should be moved to |
| label-name | The label that should trigger an issue to be moved to a specific column (mutually exclusive with milestone-name) |
| milestone-name | The milestone that should trigger an issue to be moved to a specific column (mutually exclusive with label-name) |
| columns-to-ignore | Comma separated list of column names that should be ignored. If an issue/card already exists in a column with one of the names, it will be ignored. Use `*` to ignore all columns. This is optional|


### Creating an action-token

- Create a new personal access token with the appropriate permissions at https://github.com/settings/tokens
- Add the personal access token to your repository secrets: https://github.com/organization_name/repository_name/settings/secrets (for an organization), https://github.com/repository_owner/repository_name/settings/secrets (for a standard repository), and remember the name
- Use the newly saved token in your YAML file as input for `action-token`. In the example below, it is called `MY_TOKEN`


### Example YAML (label)

This YAML is meant to be triggered whenever an issue has been labled.

```
on:
issues:
types: [labeled]
jobs:
Move_Labeled_Issue_On_Project_Board:
runs-on: ubuntu-latest
steps:
- uses: defencedigital/design-system-moveissue-action@master
with:
action-token: "${{ secrets.MY_TOKEN }}"
project-url: "https://github.com/orgs/github/projects/1"
column-name: "On Deck"
label-name: "priority"
columns-to-ignore: "In Review,Ready to deploy,Done"
```

### Example YAML (milestone)

This YAML is meant to be triggered whenever an issue has been milestoned.

```
on:
issues:
types: [milestoned]
jobs:
Move_Milestoned_Issue_On_Project_Board:
runs-on: ubuntu-latest
steps:
- uses: defencedigital/design-system-moveissue-action@master
with:
action-token: "${{ secrets.MY_TOKEN }}"
project-url: "https://github.com/orgs/github/projects/1"
column-name: "On Deck"
milestone-name: "v1.0"
columns-to-ignore: "In Review,Ready to deploy,Done"
```
27 changes: 27 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Move labeled or milestoned issue to a specific project column'
description: 'Move an newly created issue or existing issue that has been labeled or milestoned to a specific column in a project'
branding:
icon: 'move'
color: 'yellow'
inputs:
action-token:
description: 'Token for the repo. The usual secrets.GITHUB_TOKEN will not be sufficient, you must create a token that has repo permissions'
required: true
project-url:
description: 'The url of the project'
required: true
column-name:
description: 'The column that the card should end up'
required: true
label-name:
description: 'The label that specifies if an issue should be automatically moved to the column (mutually exclusive with milestone-name)'
required: false
milestone-name:
description: 'The milestone that specifies if an issue should be automatically moved to the column (mutually exclusive with label-name)'
required: false
columns-to-ignore:
description: 'Comma separated list of columns to ignore. If a card/issue is already in one of these columns, it will not be moved. Use `*` to ignore all columns'
required: false
runs:
using: 'node12'
main: 'index.js'
Binary file added demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c2c8d5f

Please sign in to comment.