Skip to content

Commit 4b48d6e

Browse files
authored
Update Workflows (#5)
1 parent d6b6e4c commit 4b48d6e

File tree

9 files changed

+198
-149
lines changed

9 files changed

+198
-149
lines changed

.github/workflows/lint.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: "Lint"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
lint:
11+
name: "Lint"
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
15+
steps:
16+
- name: "Checkout"
17+
uses: actions/checkout@v4
18+
19+
- name: "Setup Node 22"
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
#cache: npm
24+
25+
- name: "Install"
26+
id: install
27+
run: |
28+
npm install
29+
30+
- name: "ESLint"
31+
if: ${{ always() }}
32+
run: |
33+
npm run lint
34+
35+
- name: "Prettier"
36+
if: ${{ always() }}
37+
run: |
38+
npm run prettier
39+
40+
build:
41+
name: "Build"
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 5
44+
45+
steps:
46+
- name: "Checkout"
47+
uses: actions/checkout@v4
48+
49+
- name: "Setup Node 22"
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: 22
53+
#cache: npm
54+
55+
- name: "Install"
56+
run: |
57+
npm install
58+
59+
- name: "Build"
60+
run: |
61+
npm run build
62+
63+
- name: "Verify"
64+
run: |
65+
git status --porcelain dist/
66+
if [ ! -d "dist" ];then
67+
echo "Missing dist directory, run: npm build"
68+
exit 1
69+
fi
70+
if [ -n "$(git status --porcelain dist)" ];then
71+
echo "Build was not run, run: npm build"
72+
exit 1
73+
fi

.github/workflows/release.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@ on:
55
types: [published]
66

77
jobs:
8-
tags:
9-
name: "Tags"
8+
release:
9+
name: "Release"
1010
runs-on: ubuntu-latest
1111
timeout-minutes: 5
1212
permissions:
1313
contents: write
1414

1515
steps:
16-
- name: "Checkout"
17-
uses: actions/checkout@v4
18-
19-
- name: "Update Version Tags"
20-
id: tags
16+
- name: "Update Tags"
2117
uses: cssnr/update-version-tags-action@v1
22-
23-
- name: "Echo Tags"
24-
run: |
25-
echo "tags: ${{ steps.tags.outputs.tags }}"

.github/workflows/tags.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Tags"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Target Tag"
8+
required: true
9+
10+
jobs:
11+
tags:
12+
name: "Tags"
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
permissions:
16+
contents: write
17+
18+
steps:
19+
- name: "Update Tags"
20+
uses: cssnr/update-version-tags-action@v1
21+
with:
22+
tag: ${{ inputs.tag }}
23+
token: ${{ secrets.GH_PAT }}

.github/workflows/test.yaml

Lines changed: 12 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ name: "Test"
22

33
on:
44
workflow_dispatch:
5-
pull_request:
5+
schedule:
6+
- cron: "18 18 * * 1,3,5"
67
push:
78
branches: [master]
9+
pull_request:
810

911
env:
1012
ENV_FILE: .github/test/test.env
@@ -24,14 +26,14 @@ jobs:
2426
# run: |
2527
# cat "${GITHUB_EVENT_PATH}"
2628

27-
- name: "Test to JSON"
29+
- name: "1: Test to JSON"
2830
id: json
2931
uses: ./
3032
with:
3133
source: ${{ env.ENV_FILE }}
3234
dest: .github/test/results.json
3335

34-
- name: "Verify JSON"
36+
- name: "1: Verify JSON"
3537
run: |
3638
echo '${{ steps.json.outputs.result }}'
3739
cat .github/test/results.json
@@ -41,17 +43,17 @@ jobs:
4143
exit 1
4244
fi
4345
44-
- name: "Test to Environment"
46+
- name: "2: Test to Environment"
47+
if: ${{ !github.event.act }}
4548
id: env
4649
uses: ./
47-
if: ${{ !github.event.act }}
4850
with:
4951
source: ${{ env.JSON_FILE }}
5052
dest: .github/test/results.env
5153
type: "env"
5254
sensitive: true
5355

54-
- name: "Verify Environment"
56+
- name: "2: Verify Environment"
5557
if: ${{ !github.event.act }}
5658
run: |
5759
echo '${{ steps.env.outputs.result }}'
@@ -61,52 +63,8 @@ jobs:
6163
exit 1
6264
fi
6365
64-
lint:
65-
name: "Lint"
66-
runs-on: ubuntu-latest
67-
timeout-minutes: 5
68-
69-
steps:
70-
- name: "Checkout"
71-
uses: actions/checkout@v4
72-
73-
- name: "Setup Node 20"
74-
uses: actions/setup-node@v4
75-
with:
76-
node-version: 20
77-
78-
- name: "ESLint"
79-
run: |
80-
npm install
81-
npm run lint
82-
83-
build:
84-
name: "Build"
85-
runs-on: ubuntu-latest
86-
timeout-minutes: 5
87-
88-
steps:
89-
- name: "Checkout"
90-
uses: actions/checkout@v4
91-
92-
- name: "Setup Node 20"
93-
uses: actions/setup-node@v4
66+
- name: "Schedule Failure Notification"
67+
if: ${{ always() && failure() && github.event_name == 'schedule' }}
68+
uses: sarisia/actions-status-discord@v1
9469
with:
95-
node-version: 20
96-
97-
- name: "Build"
98-
run: |
99-
npm install
100-
npm run build
101-
102-
- name: "Verify"
103-
run: |
104-
git status --porcelain dist/
105-
if [ ! -d "dist" ];then
106-
echo "Missing dist directory, run: npm build"
107-
exit 1
108-
fi
109-
if [ -n "$(git status --porcelain dist)" ];then
110-
echo "Build was not run, run: npm build"
111-
exit 1
112-
fi
70+
webhook: ${{ secrets.DISCORD_WEBHOOK }}

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Release](https://img.shields.io/github/actions/workflow/status/cssnr/env-json-action/release.yaml?logo=github&logoColor=white&label=release)](https://github.com/cssnr/env-json-action/actions/workflows/release.yaml)
22
[![Test](https://img.shields.io/github/actions/workflow/status/cssnr/env-json-action/test.yaml?logo=github&logoColor=white&label=test)](https://github.com/cssnr/env-json-action/actions/workflows/test.yaml)
3+
[![Lint](https://img.shields.io/github/actions/workflow/status/cssnr/env-json-action/lint.yaml?logo=github&logoColor=white&label=lint)](https://github.com/cssnr/env-json-action/actions/workflows/lint.yaml)
34
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cssnr_env-json-action&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=cssnr_env-json-action)
45
[![GitHub Release Version](https://img.shields.io/github/v/release/cssnr/env-json-action?logo=github)](https://github.com/cssnr/env-json-action/releases/latest)
56
[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/env-json-action?logo=github&logoColor=white&label=updated)](https://github.com/cssnr/env-json-action/graphs/commit-activity)
@@ -19,27 +20,26 @@
1920
Convert an Environment File to or from JSON for Outputs or Writing to a File.
2021

2122
> [!NOTE]
22-
> Please submit
23-
> a [Feature Request](https://github.com/cssnr/env-json-action/discussions/categories/feature-requests)
23+
> Please submit a [Feature Request](https://github.com/cssnr/env-json-action/discussions/categories/feature-requests)
2424
> for new features or [Open an Issue](https://github.com/cssnr/env-json-action/issues) if you find any bugs.
2525
2626
## Inputs
2727

2828
| input | required | default | description |
29-
| --------- | -------- | ------- | ------------------------------------ |
30-
| source | Yes | - | Source Environment or JSON File Path |
31-
| type | No | `json` | Output Type: [json, env] \* |
32-
| dest | No | - | Optional File to Write Data Too |
33-
| sensitive | No | `false` | Sensitive Data \* |
34-
| summary | No | `true` | Add Summary to Job \* |
29+
| --------- | :------: | ------- | ------------------------------------ |
30+
| source | **Yes** | - | Source Environment or JSON File Path |
31+
| type | - | `json` | Output Type: [`json`, `env`] \* |
32+
| dest | - | - | Optional File to Write Data Too |
33+
| sensitive | - | `false` | Sensitive Data \* |
34+
| summary | - | `true` | Add Summary to Job \* |
3535

3636
**type** - By default this converts env to json. To perform json to env, use type `env`.
3737

3838
**sensitive** - Set to `true` if data is sensitive and should be masked.
3939

4040
**summary** - Write a Summary for the job. To disable this set to `false`.
4141

42-
<details><summary>📜 View Example Summary</summary>
42+
<details><summary>👀 View Example Summary</summary>
4343

4444
---
4545

@@ -59,6 +59,9 @@ Convert an Environment File to or from JSON for Outputs or Writing to a File.
5959

6060
</details>
6161

62+
To see a workflow run you can view a recent
63+
[test.yaml run](https://github.com/cssnr/env-json-action/actions/workflows/test.yaml) _(requires login)_.
64+
6265
```yaml
6366
- name: 'Parse Environment'
6467
uses: cssnr/env-json-action@master
@@ -101,8 +104,7 @@ If you are experiencing an issue/bug or getting unexpected results, you can:
101104
102105
- Report an Issue: https://github.com/cssnr/env-json-action/issues
103106
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
104-
- Provide General
105-
Feedback: [https://cssnr.github.io/feedback/](https://cssnr.github.io/feedback/?app=Env%20JSON%20Action)
107+
- Provide General Feedback: [https://cssnr.github.io/feedback/](https://cssnr.github.io/feedback/?app=Env%20JSON%20Action)
106108
107109
# Contributing
108110
@@ -117,7 +119,8 @@ Additionally, you can support other GitHub Actions I have published:
117119
- [Update Version Tags Action](https://github.com/cssnr/update-version-tags-action?tab=readme-ov-file#readme)
118120
- [Update JSON Value Action](https://github.com/cssnr/update-json-value-action?tab=readme-ov-file#readme)
119121
- [Parse Issue Form Action](https://github.com/cssnr/parse-issue-form-action?tab=readme-ov-file#readme)
120-
- [Mozilla Addon Update Action](https://github.com/cssnr/mozilla-addon-update-action?tab=readme-ov-file#readme)
121122
- [Cloudflare Purge Cache Action](https://github.com/cssnr/cloudflare-purge-cache-action?tab=readme-ov-file#readme)
123+
- [Mozilla Addon Update Action](https://github.com/cssnr/mozilla-addon-update-action?tab=readme-ov-file#readme)
124+
- [Docker Tags Action](https://github.com/cssnr/docker-tags-action?tab=readme-ov-file#readme)
122125
123126
For a full list of current projects to support visit: [https://cssnr.github.io/](https://cssnr.github.io/)

dist/index.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28005,20 +28005,6 @@ function toEnv(data) {
2800528005
return lines.join('\n')
2800628006
}
2800728007

28008-
/**
28009-
* @function parseInputs
28010-
* @return {{source: string, type: string, dest: string, sensitive: boolean, summary: boolean}}
28011-
*/
28012-
function parseInputs() {
28013-
return {
28014-
source: core.getInput('source', { required: true }),
28015-
type: core.getInput('type', { required: true }).toLowerCase(),
28016-
dest: core.getInput('dest'),
28017-
sensitive: core.getBooleanInput('sensitive'),
28018-
summary: core.getBooleanInput('summary'),
28019-
}
28020-
}
28021-
2802228008
/**
2802328009
* @function writeSummary
2802428010
* @param {Object} inputs
@@ -28060,6 +28046,26 @@ async function writeSummary(inputs, result) {
2806028046
await core.summary.write()
2806128047
}
2806228048

28049+
/**
28050+
* @function parseInputs
28051+
* @return {{
28052+
* source: string,
28053+
* type: string,
28054+
* dest: string,
28055+
* sensitive: boolean,
28056+
* summary: boolean
28057+
* }}
28058+
*/
28059+
function parseInputs() {
28060+
return {
28061+
source: core.getInput('source', { required: true }),
28062+
type: core.getInput('type', { required: true }).toLowerCase(),
28063+
dest: core.getInput('dest'),
28064+
sensitive: core.getBooleanInput('sensitive'),
28065+
summary: core.getBooleanInput('summary'),
28066+
}
28067+
}
28068+
2806328069
module.exports = __webpack_exports__;
2806428070
/******/ })()
2806528071
;

0 commit comments

Comments
 (0)