Skip to content

Commit 8a2d0eb

Browse files
committed
Initial build of action.
Signed-off-by: Chris. Webster <[email protected]>
1 parent e880058 commit 8a2d0eb

17 files changed

+71907
-1
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
# Matches multiple files with brace expansion notation
12+
# Set default charset
13+
[*.ts]
14+
charset = utf-8
15+
indent_style = space
16+
indent_size = 4
17+
trim_trailing_whitespace = true
18+
max_line_length = 120

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.eslintrc.js

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
module.exports = {
2+
"env": {
3+
"es6": true,
4+
"node": true
5+
},
6+
"extends": [
7+
"plugin:@typescript-eslint/recommended",
8+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
9+
"prettier"
10+
],
11+
"parser": "@typescript-eslint/parser",
12+
"parserOptions": {
13+
"project": "tsconfig.json",
14+
"sourceType": "module"
15+
},
16+
"plugins": [
17+
"anti-trojan-source",
18+
"@typescript-eslint"
19+
],
20+
"rules": {
21+
"@typescript-eslint/array-type": [
22+
"error",
23+
{
24+
"default": "array-simple"
25+
}
26+
],
27+
"@typescript-eslint/consistent-type-assertions": "error",
28+
"@typescript-eslint/dot-notation": "error",
29+
"@typescript-eslint/naming-convention": [
30+
"error",
31+
{
32+
"format": [
33+
"camelCase",
34+
"snake_case"
35+
],
36+
"selector": "variable"
37+
}
38+
],
39+
"@typescript-eslint/no-unused-expressions": "error",
40+
"@typescript-eslint/prefer-for-of": "error",
41+
"@typescript-eslint/prefer-function-type": "error",
42+
"@typescript-eslint/prefer-regexp-exec": "off",
43+
"@typescript-eslint/restrict-template-expressions": "off",
44+
"@typescript-eslint/triple-slash-reference": [
45+
"error",
46+
{
47+
"lib": "always",
48+
"path": "always",
49+
"types": "prefer-import"
50+
}
51+
],
52+
"@typescript-eslint/unified-signatures": "error",
53+
"anti-trojan-source/no-bidi": "error",
54+
"complexity": "off",
55+
"constructor-super": "error",
56+
"eqeqeq": [
57+
"error",
58+
"smart"
59+
],
60+
"guard-for-in": "error",
61+
"id-blacklist": [
62+
"error",
63+
"any",
64+
"Number",
65+
"String",
66+
"string",
67+
"Boolean",
68+
"boolean",
69+
"Undefined",
70+
"undefined"
71+
],
72+
"id-match": "error",
73+
"max-classes-per-file": [
74+
"error",
75+
1
76+
],
77+
"max-len": [
78+
"error",
79+
{
80+
"code": 120
81+
}
82+
],
83+
"new-parens": "error",
84+
"no-bitwise": "error",
85+
"no-caller": "error",
86+
"no-cond-assign": "error",
87+
"no-console": "off",
88+
"no-debugger": "error",
89+
"no-empty": "error",
90+
"no-eval": "error",
91+
"no-fallthrough": "off",
92+
"no-invalid-this": "off",
93+
"no-new-wrappers": "error",
94+
"no-shadow": [
95+
"error",
96+
{
97+
"hoist": "never"
98+
}
99+
],
100+
"no-throw-literal": "error",
101+
"no-undef-init": "error",
102+
"no-underscore-dangle": "error",
103+
"no-unsafe-finally": "error",
104+
"no-unused-labels": "error",
105+
"object-shorthand": "error",
106+
"one-var": [
107+
"error",
108+
"never"
109+
],
110+
"radix": "error",
111+
"semi": "error",
112+
"spaced-comment": [
113+
"error",
114+
"always",
115+
{
116+
"markers": [
117+
"/"
118+
]
119+
}
120+
],
121+
"use-isnan": "error"
122+
}
123+
};

.ghadocs.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"paths": {
3+
"action": "action.yml",
4+
"readme": "README.md"
5+
},
6+
"show_logo": true,
7+
"versioning": {
8+
"enabled": "true",
9+
"override": "",
10+
"prefix": "v",
11+
"branch": "main"
12+
},
13+
"owner": "gitgitgadget",
14+
"repo": "check-status",
15+
"title_prefix": "gitgitgadget Action: ",
16+
"pretty": true
17+
}

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* eol=lf
2+
*.png -eol -text binary

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
labels:
8+
- "dependencies"

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lib/
2+
node_modules/
3+
build/

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
build/

LICENSE

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

README.md

+119-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,119 @@
1-
# check-status
1+
<!-- start title -->
2+
3+
# gitgitgadget Action: check-status
4+
5+
<!-- end title -->
6+
<!-- start description -->
7+
8+
This is a GitHub action to perform various scheduled actions with projects using gitgitgadget to submit changes. It is used as a scheduled action running in a separate repo or the repo it is acting upon. The use case is for repos that will not allow complex GitHub actions in the codebase when the GitHub repo is a clone that is used to submit updates to a non-GitHub maintained repo.
9+
10+
<!-- end description -->
11+
<!-- start contents -->
12+
<!-- end contents -->
13+
14+
## Usage
15+
16+
<!-- start usage -->
17+
18+
```yaml
19+
- uses: gitgitgadget/[email protected]
20+
with:
21+
# The action to be performed. It must be one of the following: "update-open-prs",
22+
# "update-commit-mappings", "handle-open-prs", "handle-new-mails".
23+
action: ""
24+
25+
# Repository owner.
26+
repo-owner: ""
27+
28+
# Repository name.
29+
repo-name: ""
30+
31+
# A repo scoped GitHub Personal Access Token.
32+
token: ""
33+
34+
# The location of the repository.
35+
repository-dir: ""
36+
37+
# The location of the repository with gitgitgadget configuration information. This
38+
# would be used in place of the `config` parameter for the `git` repository. This
39+
# is normally the gitgitgadget repo with any needed configuration settings. Most
40+
# users will specify a `config`.
41+
config-repository-dir: ""
42+
43+
# JSON configuration for commands.
44+
config: ""
45+
```
46+
47+
<!-- end usage -->
48+
49+
## Inputs
50+
51+
<!-- start inputs -->
52+
53+
| **Input** | **Description** | **Default** | **Required** |
54+
| :-------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------: | :----------: |
55+
| **`action`** | The action to be performed. It must be one of the following: "update-open-prs", "update-commit-mappings", "handle-open-prs", "handle-new-mails". | | **true** |
56+
| **`repo-owner`** | Repository owner. | | **true** |
57+
| **`repo-name`** | Repository name. | | **true** |
58+
| **`token`** | A repo scoped GitHub Personal Access Token. | | **true** |
59+
| **`repository-dir`** | The location of the repository. | | **true** |
60+
| **`config-repository-dir`** | The location of the repository with gitgitgadget configuration information. This would be used in place of the `config` parameter for the `git` repository. This is normally the gitgitgadget repo with any needed configuration settings. Most users will specify a `config`. | | **false** |
61+
| **`config`** | JSON configuration for commands. | | **true** |
62+
63+
<!-- end inputs -->
64+
<!-- start outputs -->
65+
<!-- end outputs -->
66+
<!-- start [.github/ghdocs/examples/] -->
67+
<!-- end [.github/ghdocs/examples/] -->
68+
69+
## Contributing
70+
71+
### Environment
72+
73+
The rebuild of this document (README.md) expects a `docker`
74+
command is available from the command line.
75+
76+
### Building
77+
78+
#### action.yml changes
79+
80+
Changes to `action.yml` require rebuilding the `README.md`. This is done
81+
using `npm run build:readme`. **Note**: markup is very limited in the
82+
`action.yml`.
83+
84+
#### Source changes
85+
86+
Before making source changes, the `gitgitgadget` package must be built and
87+
installed. Other packages must also be installed but the
88+
`gitgitgadget` package is not available on npm.
89+
90+
1. In the `gitgitgadget` repo run `npm pack` to generate the package.
91+
1. Run `npm install gitgitgadget` to install the package locally. This
92+
assumes the two repos are at the same directory level.
93+
94+
Code changes are built using `npm run build`. This builds a new action in the
95+
`dist` directory.
96+
97+
### Testing
98+
99+
The action supports four different checks. The checks and associated npm
100+
commands are:
101+
102+
- update-open-prs (test:upr)
103+
- update-commit-mappings (test:ucm)
104+
- handle-open-prs (test:hop)
105+
- handle-new-mails (test:hnm)
106+
107+
A windows command is provided for testing. It requires:
108+
109+
1. A test repo set up to be monitored. A GitHub PAT must already be set as
110+
the INPUT_TOKEN environment variable or indentifed in a `.secret` file in
111+
the repo. The format of the `.secret` file is `INPUT_TOKEN=<pat>`.
112+
2. A config describing the test repo.
113+
3. For testing mail checks, a mail repo must be available with valid email.
114+
115+
The test is run using the command:
116+
117+
```
118+
npm run <test-name> <test-repo-owner> <test-repo-name> <config-location> <email-repo-location>
119+
```

action.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: check-status
2+
author: webstech
3+
description: >
4+
This is a GitHub action to perform various scheduled actions with projects
5+
using gitgitgadget to submit changes. It is used as a scheduled action
6+
running in a separate repo or the repo it is acting upon. The use case
7+
is for repos that will not allow complex GitHub actions in the codebase
8+
when the GitHub repo is a clone that is used to submit updates to a
9+
non-GitHub maintained repo.
10+
11+
inputs:
12+
action:
13+
description: >
14+
The action to be performed. It must be one of the following:
15+
"update-open-prs",
16+
"update-commit-mappings",
17+
"handle-open-prs",
18+
"handle-new-mails".
19+
required: true
20+
repo-owner:
21+
description: Repository owner.
22+
required: true
23+
repo-name:
24+
description: Repository name.
25+
required: true
26+
token:
27+
description: A repo scoped GitHub Personal Access Token.
28+
required: true
29+
repository-dir:
30+
description: The location of the repository.
31+
required: true
32+
config-repository-dir:
33+
description: The location of the repository with gitgitgadget configuration
34+
information. This would be used in place of the `config` parameter for
35+
the `git` repository. This is normally the gitgitgadget repo with any
36+
needed configuration settings. Most users will specify a `config`.
37+
required: false
38+
config:
39+
description: JSON configuration for commands.
40+
required: true
41+
42+
runs:
43+
using: 'node16'
44+
main: 'dist/index.js'
45+
46+
branding:
47+
icon: 'check'
48+
color: 'gray-dark'

0 commit comments

Comments
 (0)