-
Notifications
You must be signed in to change notification settings - Fork 1
Initial build of action #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
webstech
wants to merge
1
commit into
gitgitgadget:main
Choose a base branch
from
webstech:initial-build
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Matches multiple files with brace expansion notation | ||
# Set default charset | ||
[*.ts] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
max_line_length = 120 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
dist/ | ||
node_modules/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
export default { | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"ignorePatterns": ["build/", "dist/"], | ||
"extends": [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"anti-trojan-source", | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/array-type": [ | ||
"error", | ||
{ | ||
"default": "array-simple" | ||
} | ||
], | ||
"@typescript-eslint/consistent-type-assertions": "error", | ||
"@typescript-eslint/dot-notation": "error", | ||
"@typescript-eslint/naming-convention": [ | ||
"error", | ||
{ | ||
"format": [ | ||
"camelCase", | ||
"snake_case" | ||
], | ||
"selector": "variable" | ||
} | ||
], | ||
"@typescript-eslint/no-unused-expressions": "error", | ||
"@typescript-eslint/prefer-for-of": "error", | ||
"@typescript-eslint/prefer-function-type": "error", | ||
"@typescript-eslint/prefer-regexp-exec": "off", | ||
"@typescript-eslint/restrict-template-expressions": "off", | ||
"@typescript-eslint/triple-slash-reference": [ | ||
"error", | ||
{ | ||
"lib": "always", | ||
"path": "always", | ||
"types": "prefer-import" | ||
} | ||
], | ||
"@typescript-eslint/unified-signatures": "error", | ||
"anti-trojan-source/no-bidi": "error", | ||
"complexity": "off", | ||
"constructor-super": "error", | ||
"eqeqeq": [ | ||
"error", | ||
"smart" | ||
], | ||
"guard-for-in": "error", | ||
"id-blacklist": [ | ||
"error", | ||
"any", | ||
"Number", | ||
"String", | ||
"string", | ||
"Boolean", | ||
"boolean", | ||
"Undefined", | ||
"undefined" | ||
], | ||
"id-match": "error", | ||
"max-classes-per-file": [ | ||
"error", | ||
1 | ||
], | ||
"max-len": [ | ||
"error", | ||
{ | ||
"code": 120 | ||
} | ||
], | ||
"new-parens": "error", | ||
"no-bitwise": "error", | ||
"no-caller": "error", | ||
"no-cond-assign": "error", | ||
"no-console": "off", | ||
"no-debugger": "error", | ||
"no-empty": "error", | ||
"no-eval": "error", | ||
"no-fallthrough": "off", | ||
"no-invalid-this": "off", | ||
"no-new-wrappers": "error", | ||
"no-shadow": [ | ||
"error", | ||
{ | ||
"hoist": "never" | ||
} | ||
], | ||
"no-throw-literal": "error", | ||
"no-undef-init": "error", | ||
"no-underscore-dangle": "error", | ||
"no-unsafe-finally": "error", | ||
"no-unused-labels": "error", | ||
"object-shorthand": "error", | ||
"one-var": [ | ||
"error", | ||
"never" | ||
], | ||
"radix": "error", | ||
"semi": "error", | ||
"spaced-comment": [ | ||
"error", | ||
"always", | ||
{ | ||
"markers": [ | ||
"/" | ||
] | ||
} | ||
], | ||
"use-isnan": "error" | ||
} | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"paths": { | ||
"action": "action.yml", | ||
"readme": "README.md" | ||
}, | ||
"show_logo": true, | ||
"versioning": { | ||
"enabled": "true", | ||
"override": "", | ||
"prefix": "v", | ||
"branch": "main" | ||
}, | ||
"owner": "gitgitgadget", | ||
"repo": "gitgitgadget-action-check-status", | ||
"title_prefix": "gitgitgadget Action: ", | ||
"pretty": true | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* eol=lf | ||
*.png -eol -text binary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: 2 | ||
updates: | ||
# Run monthly with no limits | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
open-pull-requests-limit: 10 | ||
|
||
updates: | ||
# Run weekly ignoring patches (esp linters) | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
# For @types packages, ignore all patch updates | ||
- dependency-name: "@types/*" | ||
update-types: ["version-update:semver-patch"] | ||
# For eslint packages, ignore all patch updates | ||
- dependency-name: "eslint" | ||
update-types: ["version-update:semver-patch"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build/ | ||
node_modules/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist/ | ||
build/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Chris. Webster | ||
|
||
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,121 @@ | ||
# check-status | ||
<!-- start title --> | ||
|
||
# gitgitgadget Action: check-status | ||
|
||
<!-- end title --> | ||
<!-- start description --> | ||
|
||
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. | ||
|
||
<!-- end description --> | ||
<!-- start contents --> | ||
<!-- end contents --> | ||
|
||
## Usage | ||
|
||
<!-- start usage --> | ||
|
||
```yaml | ||
- uses: gitgitgadget/gitgitgadget-action-check-status@v0.5.0 | ||
with: | ||
# The action to be performed. It must be one of the following: "update-open-prs", | ||
# "update-commit-mappings", "handle-open-prs", "handle-new-mails". | ||
action: "" | ||
|
||
# Repository owner. | ||
repo-owner: "" | ||
|
||
# Repository name. | ||
repo-name: "" | ||
dscho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# A repo scoped GitHub Personal Access Token. | ||
token: "" | ||
|
||
# The location of the repository. | ||
repository-dir: "" | ||
dscho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# 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`. | ||
config-repository-dir: "" | ||
|
||
# JSON configuration for commands. | ||
config: "" | ||
``` | ||
|
||
<!-- end usage --> | ||
|
||
## Inputs | ||
|
||
<!-- start inputs --> | ||
|
||
| **Input** | **Description** | **Default** | **Required** | | ||
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ------------ | | ||
| **`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** | | ||
| **`repo-owner`** | Repository owner. | | **true** | | ||
| **`repo-name`** | Repository name. | | **true** | | ||
| **`token`** | A repo scoped GitHub Personal Access Token. | | **true** | | ||
| **`repository-dir`** | The location of the repository. | | **true** | | ||
| **`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** | | ||
| **`config`** | JSON configuration for commands. | | **true** | | ||
|
||
<!-- end inputs --> | ||
<!-- start outputs --> | ||
<!-- end outputs --> | ||
<!-- start [.github/ghdocs/examples/] --> | ||
<!-- end [.github/ghdocs/examples/] --> | ||
|
||
## Contributing | ||
The current tests are Windows based. | ||
|
||
### Using a local `gitgitgadget` | ||
This action is a thin layer that uses [gitgitgadget](https://github.com/gitgitgadget/gitgitgadget) | ||
for most of the processing. If you have local changes to `gitgitgadget` that need to be | ||
tested: | ||
1. In the `gitgitgadget` project run `npm pack` to generate an installable package. By default, | ||
the package will be located in the root directory of the project. This can be changed by | ||
specifying `--pack-destination=` on the command. | ||
2. Change the `package.json` to point to the `tgz` packaage file and run `npm install gitgitgadget`. | ||
|
||
### action.yml changes | ||
Changes to `action.yml` require regenerating the `README.md`. This is done using `docker`. If it | ||
is not available it should be installed. The `README.md` is updated using `npm run build:readme`. | ||
**Note**: markup is very limited in the `action.yml`. | ||
|
||
### Source Changes | ||
The action is built using `npm run build`. This builds a standalone runnable at `dist/index.js`. | ||
|
||
### Testing | ||
The action supports four different checks. The checks and associated npm commands are: | ||
|
||
- update-open-prs (test:upr) | ||
- update-commit-mappings (test:ucm) | ||
- handle-open-prs (test:hop) | ||
- handle-new-mails (test:hnm) | ||
|
||
A windows command is provided for testing. It requires: | ||
|
||
1. A test repo set up to be monitored. A GitHub PAT must already be set as | ||
the INPUT_TOKEN environment variable or indentifed in a `.secret` file in | ||
the repo. The format of the `.secret` file is `INPUT_TOKEN=<pat>`. | ||
2. A config describing the test repo. | ||
3. For testing mail checks, a mail repo must be available with valid email. | ||
|
||
The test is run using the command: | ||
|
||
``` | ||
npm run <test-name> <test-repo-owner> <test-repo-name> <config-location> <email-repo-location> | ||
``` | ||
### Make a pull request | ||
First, if there are related `gitgitgadget` changes, that pull request should be done first. A fresh | ||
install, build and test should be done using the unmodified `package.json`. | ||
|
||
`npm version` may need to be done based on the level of change. If this is done, make sure the | ||
tags get pushed to GitHub. | ||
|
||
The patch series will need to include the `dist/index.js`. | ||
|
||
## TODO | ||
A separate action will be developed to rebuild the `dist/index.js` as needed when updates to | ||
`gitgitgadget` have been made. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: gitgitgadget-action-check-status | ||
author: webstech | ||
description: > | ||
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. | ||
|
||
inputs: | ||
action: | ||
description: > | ||
The action to be performed. It must be one of the following: | ||
"update-open-prs", | ||
"update-commit-mappings", | ||
"handle-open-prs", | ||
"handle-new-mails". | ||
required: true | ||
repo-owner: | ||
description: Repository owner. | ||
required: true | ||
repo-name: | ||
description: Repository name. | ||
required: true | ||
token: | ||
description: A repo scoped GitHub Personal Access Token. | ||
required: true | ||
repository-dir: | ||
description: The location of the repository. | ||
required: true | ||
config-repository-dir: | ||
description: 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`. | ||
required: false | ||
config: | ||
description: JSON configuration for commands. | ||
required: true | ||
|
||
runs: | ||
using: 'node18' | ||
main: 'dist/index.js' | ||
|
||
branding: | ||
icon: 'check' | ||
color: 'gray-dark' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.