Skip to content

Commit bc490f6

Browse files
author
ADMSK\AVROGAL1
committed
docs: updates on workflows
Added information on documentation
1 parent 359c962 commit bc490f6

10 files changed

Lines changed: 158 additions & 3974 deletions

File tree

.env-cmdrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"dev": {
3+
"DEBUG": "true"
4+
},
5+
"prod": {
6+
"DEBUG": "false"
7+
},
8+
"test": {
9+
"TZ": "utc"
10+
}
11+
}

.github/workflows/main.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,53 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v2
15-
- run: |
16-
npm install
17-
- run: |
15+
with:
16+
ref: ${{ github.head_ref }}
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v1
20+
21+
- name: Pull from current branch
22+
run: git pull origin ${GITHUB_REF##*/}
23+
24+
- name: Install Dependencies
25+
run: npm install
26+
27+
- name: Build project
28+
run: |
1829
npm run all
1930
31+
- name: Run tests
32+
run: |
33+
npm run test:all
34+
2035
test: # make sure the action works on a clean machine without building
2136
runs-on: ubuntu-latest
2237
steps:
2338
- uses: actions/checkout@v2
39+
with:
40+
ref: ${{ github.head_ref }}
41+
42+
- name: Setup Node.js
43+
uses: actions/setup-node@v1
44+
45+
- name: Pull from current branch
46+
run: git pull origin ${GITHUB_REF##*/}
47+
48+
- name: Install Dependencies
49+
run: npm install
50+
2451
- uses: ./
2552
with:
2653
jsonMode: 'unique'
2754
sourceFile: ./data/african_proverbs.json
2855
targetPath: ./data
29-
destFile: ./data/african_proverbs_unique.json
56+
destFile: african_proverbs_unique.json
3057
targetProperty: 'african'
3158
fields: 'text'
59+
60+
- name: Push changes
61+
uses: stefanzweifel/git-auto-commit-action@v4
62+
with:
63+
commit_message: Add images pulled from headless browser to folder
64+
commit_options: '--no-verify --signoff'

.husky/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
_
1+
_

README.md

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# _Json unique fields_
1+
# _Json fields_
22

3-
> GitHub Action to generate json with unique fields
3+
> GitHub Action to process JSON file by provided fields
44
5-
[![GitHub marketplace](https://img.shields.io/badge/marketplacegithub-json--fields-unique-blue?logo=github)](https://github.com/marketplace/actions/json-fields)
5+
[![GitHub marketplace](https://img.shields.io/badge/marketplacegithub-json--fields-blue?logo=github)](https://github.com/marketplace/actions/json-fields)
66

77
[![management: perfekt👌](https://img.shields.io/badge/management-perfekt👌-red.svg)](https://github.com/lekterable/perfekt)
88
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
@@ -72,7 +72,7 @@
7272

7373
<p align="center" style="text-align:center;">
7474
<a href="https://www.typescriptlang.org/">
75-
<img src="https://img.shields.io/badge/javascript%20-%23323330.svg?&logo=javascript&logoColor=%23F7DF1E" alt="JavaScript" />
75+
<img src="https://img.shields.io/badge/javascript%20-%23323330.svg?&logo=typescript&logoColor=%23F7DF1E" alt="Typescript" />
7676
</a>
7777
<a href="https://www.repostatus.org/#active">
7878
<img src="https://img.shields.io/badge/Project%20Status-Active-brightgreen" alt="Project Status: Active – The project has reached a stable, usable state and is being actively developed." />
@@ -85,71 +85,73 @@
8585
</a>
8686
</p>
8787

88-
Creates _**Json Unique Fields**_ by language and input color parameters.
88+
Processes JSON file by provided list of fields and file source parameters.
8989

9090
## _Inputs_
9191

92-
### `language`
92+
### `jsonMode`
9393

94-
**Optional** Proverb's language (default **random**)
94+
**Required** JSON operation mode
9595

96-
### `pattern`
96+
#### `unique`
9797

98-
**Optional** Proverb's image background pattern (default **random**)
98+
Only unique fields to be filtered
9999

100-
### `width`
100+
#### `duplicate`
101101

102-
**Optional** Proverb's image width (default **100%**)
102+
Only duplicate fields to be filtered
103103

104-
### `height`
104+
### `sourceFile`
105105

106-
**Optional** Proverb's image height (default **100%**)
106+
**Required** JSON source file to operate by
107107

108-
### `backgroundColor`
108+
### `targetPath`
109109

110-
**Optional** Proverb's image background color (default **%23FFFFFF**)
110+
**Required** Target path to store filtered JSON file
111111

112-
### `fontColor`
112+
### `destFile`
113113

114-
**Optional** Proverb's image font color (default **%230A83DC**)
114+
**Required** JSON destination file name
115115

116-
### `opacity`
116+
### `targetProperty`
117117

118-
**Optional** Proverb's image background opacity (default **0.3**)
118+
**Required** String representing slash-separated list of properties hierarchy to operate by (**property1/property2/.../propertyN**)
119119

120-
### `colorPattern`
120+
### `fields`
121121

122-
**Optional** Proverb's image text color (default **%23FFE0E9**)
122+
**Optional** String representing comma-separated list of fields to operate by (**field1,field2,...,fieldN**)
123123

124-
### `name`
124+
## _Outputs_
125125

126-
**Optional** Proverb's image name (default **proverb**)
126+
### `status`
127127

128-
### `path`
128+
JSON operation status
129129

130-
**Optional** Proverb's image path (default **images**)
130+
#### `true`
131131

132-
## _Outputs_
132+
When file successfully processed and stored to destination folder
133133

134-
### `image`
134+
#### `false`
135135

136-
Generated proverb image (stored in the `path` directory)
136+
When errors occurred while processing source file
137137

138138
## _Examples_
139139

140140
```yml
141-
- name: Create json with unique fields
141+
- name: Process JSON file by fields
142142
uses: alexrogalskiy/github-action-json-fields@master
143143
with:
144-
language: 'french'
145-
pattern: 'wiggle'
146-
name: 'proverb'
147-
path: 'images'
144+
jsonMode: 'unique'
145+
sourceFile: ./data/african_proverbs.json
146+
targetPath: ./data
147+
destFile: african_proverbs_unique.json
148+
targetProperty: 'african'
149+
fields: 'text'
148150
```
149151
150152
Running locally:
151153
152-
- `npm run start:action --action github-action-json-fields --language 'french' --pattern 'wiggle' --name proverb --path images`
154+
- `npm run start:action --action github-action-json-fields --jsonMode 'unique' --sourceFile './data/african_proverbs.json' --targetPath './data' --destFile 'african_proverbs_unique.json' --targetProperty 'african' --fields 'text'`
153155

154156
## _Visitor stats_
155157

@@ -161,15 +163,15 @@ Running locally:
161163

162164
## _Licensing_
163165

164-
_**Json Unique Fields**_ is distributed under LGPL version 3 or later,
166+
_**Json Fields**_ is distributed under LGPL version 3 or later,
165167
[[License](https://github.com/AlexRogalskiy/github-action-json-fields/blob/master/LICENSE)]. LGPLv3 is additional
166168
permissions on top of GPLv3.
167169

168170
![license](https://user-images.githubusercontent.com/19885116/48661948-6cf97e80-ea7a-11e8-97e7-b45332a13e49.png)
169171

170172
## _Authors_
171173

172-
_**Json Unique Fields**_ is maintained by the following GitHub team-members:
174+
_**Json Fields**_ is maintained by the following GitHub team-members:
173175

174176
- [![Author](https://img.shields.io/badge/author-AlexRogalskiy-FB8F0A)](https://github.com/AlexRogalskiy)
175177

@@ -207,7 +209,7 @@ See also the list of [contributors][contributors] who participated in this proje
207209

208210
## _Development Support_
209211

210-
Like _**Json Unique Fields**_ ? Consider buying me a coffee :\)
212+
Like _**Json Fields**_ ? Consider buying me a coffee :\)
211213

212214
[![Become a Patron](https://img.shields.io/badge/Become_Patron-Support_me_on_Patreon-blue.svg?style=flat-square&logo=patreon&color=e64413)](https://www.patreon.com/alexrogalskiy)
213215
[![Buy Me A Coffee](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-yellow.svg?logo=buy%20me%20a%20coffee)](https://www.buymeacoffee.com/AlexRogalskiy)

action.yml

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,36 @@
1-
name: 'Json Unique Fields'
2-
description: 'Create JSON with unique fields'
1+
name: 'Json Fields'
2+
description: 'Create JSON file with filtered fields (unique/duplicate)'
33
author: 'AlexRogalskiy'
44

55
inputs:
6-
language:
7-
description: 'proverbs language'
8-
required: false
9-
default: 'random'
10-
pattern:
11-
description: 'proverbs image background pattern'
12-
required: false
13-
default: 'random'
14-
width:
15-
description: 'proverbs image width'
16-
required: false
17-
default: '100%'
18-
height:
19-
description: 'proverbs image height'
20-
required: false
21-
default: '100%'
22-
backgroundColor:
23-
description: 'proverbs image background color'
24-
required: false
25-
default: '%23FFFFFF'
26-
fontColor:
27-
description: 'proverbs image font color'
28-
required: false
29-
default: '%230A83DC'
30-
opacity:
31-
description: 'proverbs image background opacity'
32-
required: false
33-
default: '0.3'
34-
colorPattern:
35-
description: 'proverbs image text color'
36-
required: false
37-
default: '%23FFE0E9'
38-
name:
39-
description: 'proverbs image name'
40-
required: false
41-
default: 'quote'
42-
path:
43-
description: 'proverbs image path'
44-
required: false
45-
default: 'images'
6+
jsonMode:
7+
description: 'JSON operation mode (unique/duplicate)'
8+
required: true
9+
sourceFile:
10+
description: 'JSON source file'
11+
required: true
12+
targetPath:
13+
description: 'Target path to store filtered JSON file'
14+
required: true
15+
destFile:
16+
description: 'JSON destination file name'
17+
required: true
18+
targetProperty:
19+
description: 'JSON target property name to operate by'
20+
required: true
21+
fields:
22+
description: 'JSON fields to operate by'
23+
required: true
4624

4725
outputs:
48-
image:
49-
description: 'proverb image generated by input parameters'
26+
status:
27+
description: 'JSON operation status'
5028

5129
runs:
5230
using: 'node12'
5331
main: 'dist/index.js'
5432

5533
# Ref: https://haya14busa.github.io/github-action-brandings/
5634
branding:
57-
icon: 'bookmark'
58-
color: 'blue'
35+
icon: 'file-text'
36+
color: 'white'

jest.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ module.exports = {
44
clearMocks: true,
55
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
66
testEnvironment: 'node',
7-
testMatch: ['**/*.test.ts', '**/__tests__/**/?(*.)+(spec|test).ts'],
7+
testMatch: ['**/*.test.(ts|js)', '**/__tests__/**/?(*.)+(spec|test).ts'],
88
testRunner: 'jest-circus/runner',
9-
testPathIgnorePatterns: ['/node_modules/', '/__fixtures__/'],
9+
testPathIgnorePatterns: ['/node_modules/', '/__fixtures__/', '/spec/'],
1010
transform: {
1111
'^.+\\.(ts)$': 'ts-jest',
1212
},
1313
collectCoverage: true,
1414
collectCoverageFrom: [
1515
'**/*.ts',
1616
'!**/*.d.ts',
17+
'!**/*.folio.ts',
18+
'!**/*.spec.ts',
1719
'!**/dist/**',
1820
'!**/node_modules/**',
1921
'!**/vendor/**',

0 commit comments

Comments
 (0)