Skip to content

Commit a69c03e

Browse files
committed
Initial commit
0 parents  commit a69c03e

19 files changed

+13328
-0
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist/
2+
lib/
3+
node_modules/
4+
jest.config.js

.eslintrc.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"plugins": ["jest", "@typescript-eslint"],
3+
"extends": ["plugin:github/recommended"],
4+
"parser": "@typescript-eslint/parser",
5+
"parserOptions": {
6+
"ecmaVersion": 9,
7+
"sourceType": "module",
8+
"project": "./tsconfig.json"
9+
},
10+
"rules": {
11+
"i18n-text/no-en": "off",
12+
"eslint-comments/no-use": "off",
13+
"import/no-namespace": "off",
14+
"no-unused-vars": "off",
15+
"@typescript-eslint/no-unused-vars": "error",
16+
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
17+
"@typescript-eslint/no-require-imports": "error",
18+
"@typescript-eslint/array-type": "error",
19+
"@typescript-eslint/await-thenable": "error",
20+
"@typescript-eslint/ban-ts-comment": "error",
21+
"camelcase": "off",
22+
"@typescript-eslint/consistent-type-assertions": "error",
23+
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
24+
"@typescript-eslint/func-call-spacing": ["error", "never"],
25+
"@typescript-eslint/no-array-constructor": "error",
26+
"@typescript-eslint/no-empty-interface": "error",
27+
"@typescript-eslint/no-explicit-any": "error",
28+
"@typescript-eslint/no-extraneous-class": "error",
29+
"@typescript-eslint/no-for-in-array": "error",
30+
"@typescript-eslint/no-inferrable-types": "error",
31+
"@typescript-eslint/no-misused-new": "error",
32+
"@typescript-eslint/no-namespace": "error",
33+
"@typescript-eslint/no-non-null-assertion": "warn",
34+
"@typescript-eslint/no-unnecessary-qualifier": "error",
35+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
36+
"@typescript-eslint/no-useless-constructor": "error",
37+
"@typescript-eslint/no-var-requires": "error",
38+
"@typescript-eslint/prefer-for-of": "warn",
39+
"@typescript-eslint/prefer-function-type": "warn",
40+
"@typescript-eslint/prefer-includes": "error",
41+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
42+
"@typescript-eslint/promise-function-async": "error",
43+
"@typescript-eslint/require-array-sort-compare": "error",
44+
"@typescript-eslint/restrict-plus-operands": "error",
45+
"semi": "off",
46+
"@typescript-eslint/semi": ["error", "never"],
47+
"@typescript-eslint/type-annotation-spacing": "error",
48+
"@typescript-eslint/unbound-method": "error"
49+
},
50+
"env": {
51+
"node": true,
52+
"es6": true,
53+
"jest/globals": true
54+
}
55+
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/** -diff linguist-generated=true

.gitignore

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Dependency directory
2+
node_modules
3+
4+
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
jspm_packages/
46+
47+
# TypeScript v1 declaration files
48+
typings/
49+
50+
# TypeScript cache
51+
*.tsbuildinfo
52+
53+
# Optional npm cache directory
54+
.npm
55+
56+
# Optional eslint cache
57+
.eslintcache
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Output of 'npm pack'
63+
*.tgz
64+
65+
# Yarn Integrity file
66+
.yarn-integrity
67+
68+
# dotenv environment variables file
69+
.env
70+
.env.test
71+
72+
# parcel-bundler cache (https://parceljs.org/)
73+
.cache
74+
75+
# next.js build output
76+
.next
77+
78+
# nuxt.js build output
79+
.nuxt
80+
81+
# vuepress build output
82+
.vuepress/dist
83+
84+
# Serverless directories
85+
.serverless/
86+
87+
# FuseBox cache
88+
.fusebox/
89+
90+
# DynamoDB Local files
91+
.dynamodb/
92+
93+
# OS metadata
94+
.DS_Store
95+
Thumbs.db
96+
97+
# Ignore built ts files
98+
__tests__/runner/*
99+
lib/**/*

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid"
10+
}

LICENSE

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright (c) 2021, Inesh Bose
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
the Software, and to permit persons to whom the Software is furnished to do so,
8+
subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Project Card Action
2+
3+
A [GitHub Action](https://help.github.com/en/actions) that moves *issue* cards in your [project boards](https://docs.github.com/en/issues/organizing-your-work-with-project-boards/managing-project-boards/about-project-boards), without having to specify the board and column names, from a workflow. **This project is in BETA. Please report bugs if encountered.**
4+
5+
## Usage
6+
7+
```yml
8+
name: Move card
9+
10+
on:
11+
# refer https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#issues
12+
issues:
13+
types: [assigned]
14+
# refer https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#issue_comment
15+
issue_comment:
16+
types: [created]
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: ineshbose/project-card-action@v1
23+
with:
24+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
ISSUE_NUMBER: ${{ github.event.issue.number }}
26+
TARGET_COLUMN: 'Review'
27+
```
28+
29+
<table>
30+
<thead>
31+
<tr>
32+
<th>Argument</th>
33+
<th>Required</th>
34+
<th>Default</th>
35+
<th>Description</th>
36+
</tr>
37+
</thead>
38+
<tbody>
39+
<tr>
40+
<td>GH_TOKEN</td>
41+
<td>Yes</td>
42+
<td></td>
43+
<td>GitHub Token required to make changes. You can use ${{ secrets.GITHUB_TOKEN }}.</td>
44+
</tr>
45+
<tr>
46+
<td>ISSUE_NUMBER</td>
47+
<td>Yes</td>
48+
<td></td>
49+
<td>The issue number that the card is connected to.</td>
50+
</tr>
51+
<tr>
52+
<td>PROJECT_NAME</td>
53+
<td>No</td>
54+
<td></td>
55+
<td>The project/board where the card <i>should</i> be. The action searches through all projects/boards otherwise.</td>
56+
</tr>
57+
<tr>
58+
<td>SOURCE_COLUMN</td>
59+
<td>No</td>
60+
<td></td>
61+
<td>The column where the card <i>should</i> be. The action searches through all columns otherwise.</td>
62+
</tr>
63+
<tr>
64+
<td>TARGET_COLUMN</td>
65+
<td>Yes</td>
66+
<td></td>
67+
<td>The column where the card should be moved.</td>
68+
</tr>
69+
<tr>
70+
<td>CARD_POSITION</td>
71+
<td>No</td>
72+
<td>bottom</td>
73+
<td>The position of the card in the target column.</td>
74+
</tr>
75+
</tbody>
76+
</table>

__tests__/main.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as process from 'process'
2+
import * as cp from 'child_process'
3+
import * as path from 'path'
4+
import {expect, test} from '@jest/globals'
5+
6+
test('test runs', () => {
7+
process.env['GITHUB_REPOSITORY'] = 'ineshbose/project-card-action'
8+
process.env['INPUT_GH_TOKEN'] = ''
9+
process.env['INPUT_ISSUE_NUMBER'] = '1'
10+
process.env['INPUT_TARGET_COLUMN'] = 'Review'
11+
const program = cp.execFile(process.execPath, [path.join(__dirname, '..', 'lib', 'main.js')], { env: process.env })
12+
})

action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Project Card Action"
2+
description: "Move issue cards across your GitHub project board automatically."
3+
4+
inputs:
5+
GH_TOKEN:
6+
description: "GitHub token"
7+
required: true
8+
ISSUE_NUMBER:
9+
description: "Issue number of card"
10+
required: true
11+
PROJECT_NAME:
12+
description: "Name of project/board"
13+
required: false
14+
SOURCE_COLUMN:
15+
description: "Name of source column"
16+
required: false
17+
TARGET_COLUMN:
18+
description: "Name of target column"
19+
required: true
20+
CARD_POSITION:
21+
description: "Position of card"
22+
required: false
23+
default: "bottom"
24+
25+
runs:
26+
using: "node12"
27+
main: "dist/index.js"
28+
29+
branding:
30+
icon: "layout"
31+
color: "blue"

0 commit comments

Comments
 (0)