Skip to content

Commit 9c81b65

Browse files
committed
feat: first working version
1 parent 2c33aa3 commit 9c81b65

File tree

14 files changed

+24145
-1
lines changed

14 files changed

+24145
-1
lines changed

.eslintignore

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

.eslintrc

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
env:
2+
node: true
3+
es6: true
4+
jest/globals: true
5+
6+
plugins:
7+
- sonarjs
8+
- jest
9+
10+
extends:
11+
- plugin:sonarjs/recommended
12+
13+
parserOptions:
14+
ecmaVersion: 2018
15+
16+
rules:
17+
# Ignore Rules
18+
strict: 0
19+
no-underscore-dangle: 0
20+
no-mixed-requires: 0
21+
no-process-exit: 0
22+
no-warning-comments: 0
23+
curly: 0
24+
no-multi-spaces: 0
25+
no-alert: 0
26+
consistent-return: 0
27+
consistent-this: [0, self]
28+
func-style: 0
29+
max-nested-callbacks: 0
30+
camelcase: 0
31+
32+
# Warnings
33+
no-debugger: 1
34+
no-empty: 1
35+
no-invalid-regexp: 1
36+
no-unused-expressions: 1
37+
no-native-reassign: 1
38+
no-fallthrough: 1
39+
sonarjs/cognitive-complexity: 1
40+
41+
# Errors
42+
eqeqeq: 2
43+
no-undef: 2
44+
no-dupe-keys: 2
45+
no-empty-character-class: 2
46+
no-self-compare: 2
47+
valid-typeof: 2
48+
no-unused-vars: [2, { "args": "none" }]
49+
handle-callback-err: 2
50+
no-shadow-restricted-names: 2
51+
no-new-require: 2
52+
no-mixed-spaces-and-tabs: 2
53+
block-scoped-var: 2
54+
no-else-return: 2
55+
no-throw-literal: 2
56+
no-void: 2
57+
radix: 2
58+
wrap-iife: [2, outside]
59+
no-shadow: 0
60+
no-use-before-define: [2, nofunc]
61+
no-path-concat: 2
62+
valid-jsdoc: [0, {requireReturn: false, requireParamDescription: false, requireReturnDescription: false}]
63+
64+
# stylistic errors
65+
no-spaced-func: 2
66+
semi-spacing: 2
67+
quotes: [2, 'single']
68+
key-spacing: [2, { beforeColon: false, afterColon: true }]
69+
indent: [2, 2]
70+
no-lonely-if: 2
71+
no-floating-decimal: 2
72+
brace-style: [2, 1tbs, { allowSingleLine: true }]
73+
comma-style: [2, last]
74+
no-multiple-empty-lines: [2, {max: 1}]
75+
no-nested-ternary: 2
76+
operator-assignment: [2, always]
77+
padded-blocks: [2, never]
78+
quote-props: [2, as-needed]
79+
keyword-spacing: [2, {'before': true, 'after': true, 'overrides': {}}]
80+
space-before-blocks: [2, always]
81+
array-bracket-spacing: [2, never]
82+
computed-property-spacing: [2, never]
83+
space-in-parens: [2, never]
84+
space-unary-ops: [2, {words: true, nonwords: false}]
85+
wrap-regex: 2
86+
linebreak-style: [2, unix]
87+
semi: [2, always]
88+
arrow-spacing: [2, {before: true, after: true}]
89+
no-class-assign: 2
90+
no-const-assign: 2
91+
no-dupe-class-members: 2
92+
no-this-before-super: 2
93+
no-var: 2
94+
object-shorthand: [2, always]
95+
prefer-arrow-callback: 2
96+
prefer-const: 2
97+
prefer-spread: 2
98+
prefer-template: 2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
clones

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# org-projects-dependency-manager
1+
# Organization Projects' Dependency Manager
22
GitHub Action that handles automated update of dependencies in package.json between projects from the same GitHub organization.
3+
4+
<!-- toc -->
5+
6+
- [Why I Created This Action?](#why-i-created-this-action)
7+
- [Action Flow](#action-flow)
8+
- [Configuration](#configuration)
9+
- [Examples](#examples)
10+
* [Minimum Workflow](#minimum-workflow)
11+
* [Advanced Workflow](#advanced-workflow)
12+
- [Development](#development)
13+
14+
<!-- tocstop -->
15+
16+
## Why I Created This Action?
17+
18+
//TODO
19+
20+
## Action Flow
21+
22+
<img src="diagram.png" alt="flow diagram" width="20%">
23+
24+
## Configuration
25+
26+
Name | Description | Required | Default
27+
--|------|--|--
28+
github_token | Token to use GitHub API. It must have "repo" scopes so it can push to repos. It cannot be the default GitHub Actions token GITHUB_TOKEN. GitHub Action token's permissions are limited to the repository that contains your workflows. Provide token of the user that has rights to push to the repos that this action is suppose to update. | true | -
29+
packagejson_path | Path to package.json file if not located in the root of the project. Provide just the path without file name. In the format: `./nested/location`. | false | `./`
30+
committer_username | The username (not display name) of the committer will be used to commit changes in the workflow file in a specific repository. In the format `web-flow`. | false | `web-flow`
31+
committer_email | The committer's email that will be used in the commit of changes in the workflow file in a specific repository. In the format `[email protected]`.| false | `[email protected]`
32+
commit_message_prod | It is used as a commit message when bumping dependency from "dependencies" section in package.json. In case dependency is located in both dependencies and devDependencies of dependant, then prod commit message is used. It is also used as a title of the pull request that is created by this action. | false | `Update dependency`
33+
commit_message_dev | It is used as a commit message when bumping dependency from "devDependencies" section in package.json. It is also used as a title of the pull request that is created by this action. | false | `Update devDependency`
34+
repos_to_ignore | Comma-separated list of repositories that should not get updates from this action. Action already ignores the repo in which the action is triggered so you do not need to add it explicitly. In the format `repo1,repo2`. | false | -
35+
36+
## Examples
37+
38+
//TODO
39+
40+
### Minimum Workflow
41+
42+
### Advanced Workflow
43+
44+
## Development
45+
46+
```bash
47+
# GITHUB_TOKEN provide personal GitHub token with scope to push to repos
48+
# GITHUB_REPOSITORY provide name of org/user and the repo in which this workflow is suppose to run
49+
# PACKAGE_JSON_LOC=test is a path to package.json file against you want to test
50+
GITHUB_TOKEN=token PACKAGE_JSON_LOC=test GITHUB_REPOSITORY="lukasz-lab/.github" npm start
51+
```
52+
53+
## TODO
54+
55+
This action should not be used yet. I need to:
56+
- write decent amount of tests as this action can do some harm
57+
- make final clarification of search usage
58+
- provide examples

action.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Organization Projects' Dependency Manager
2+
description: This action handles automated update of dependencies in package.json between projects from the same GitHub organization.
3+
inputs:
4+
github_token:
5+
description: >
6+
Token to use GitHub API. It must have "repo" scopes so it can push to repos.
7+
It cannot be the default GitHub Actions token GITHUB_TOKEN. GitHub Action token's permissions are limited to the repository that contains your workflows.
8+
Provide token of the user that has rights to push to the repos that this action is suppose to update.
9+
required: true
10+
committer_username:
11+
description: >
12+
The username (not display name) of the committer that will be used in the commit of changes in the workflow file in specific repository.
13+
In the format `web-flow`.
14+
default: web-flow
15+
required: false
16+
committer_email:
17+
description: >
18+
The email of the committer that will be used in the commit of changes in the workflow file in specific repository.
19+
In the format `[email protected]`.
20+
21+
required: false
22+
commit_message_prod:
23+
description: >
24+
It is used as a commit message when bumping dependency from "dependencies" section in package.json.
25+
In case dependency is located in both dependencies and devDependencies of dependant, then prod commit message is used.
26+
It is also used as a title of the pull request that is created by this action.
27+
default: Update dependency
28+
required: false
29+
commit_message_dev:
30+
description: >
31+
It is used as a commit message when bumping dependency from "devDependencies" section in package.json.
32+
It is also used as a title of the pull request that is created by this action.
33+
default: Update devDependency
34+
required: false
35+
packagejson_path:
36+
description: >
37+
Path to package.json file if not located in the root of the project. Provide just the path without file name. In the format: `./nested/location`.
38+
default: ./
39+
required: false
40+
repos_to_ignore:
41+
description: >
42+
Comma-separated list of repositories that should not get updates from this action.
43+
Action already ignores the repo in which the action is triggered so you do not need to add it explicitly.
44+
In the format: `repo1,repo2`.
45+
required: false
46+
runs:
47+
using: node12
48+
main: dist/index.js
49+
branding:
50+
icon: chevrons-up
51+
color: gray-dark

diagram.png

35.4 KB
Loading

0 commit comments

Comments
 (0)