Skip to content

Commit 7d98d3c

Browse files
authored
Updates (#8)
1 parent b6c2588 commit 7d98d3c

File tree

15 files changed

+427
-333
lines changed

15 files changed

+427
-333
lines changed

.github/workflows/check-build.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Check Build"
2+
3+
on:
4+
pull_request_target:
5+
paths:
6+
- "dist/**"
7+
- "src/**"
8+
- "package*.json"
9+
- "rollup.config.*"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
check-build:
17+
name: "Check Build"
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
21+
permissions:
22+
pull-requests: write
23+
issues: write
24+
25+
steps:
26+
- name: "Debug CTX github"
27+
continue-on-error: true
28+
env:
29+
GITHUB_CTX: ${{ toJSON(github) }}
30+
run: echo "$GITHUB_CTX"
31+
32+
- name: "Checkout Pull"
33+
uses: actions/checkout@v5
34+
with:
35+
ref: ${{ github.event.pull_request.head.sha }}
36+
37+
- name: "Debug"
38+
continue-on-error: true
39+
run: |
40+
echo "::group::ls"
41+
ls -lAh
42+
echo "::endgroup::"
43+
echo "::group::tree"
44+
tree .
45+
echo "::endgroup::"
46+
47+
- name: "Check Build Action"
48+
uses: cssnr/check-build-action@v1

.github/workflows/lint.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ concurrency:
1313
jobs:
1414
lint:
1515
name: "Lint"
16+
if: ${{ !contains(github.event.head_commit.message, '#nolint') }}
1617
runs-on: ubuntu-latest
1718
timeout-minutes: 5
1819

@@ -24,7 +25,7 @@ jobs:
2425
uses: actions/checkout@v5
2526

2627
- name: "Setup Node 24"
27-
uses: actions/setup-node@v5
28+
uses: actions/setup-node@v6
2829
with:
2930
node-version: 24
3031

@@ -75,11 +76,7 @@ jobs:
7576
run: |
7677
yq -e '.runs.main | test("^dist/")' action.yml
7778
78-
- name: "Check Build Action"
79-
if: ${{ !cancelled() }}
80-
uses: cssnr/check-build-action@v1
81-
8279
- name: "ESLint Annotate"
8380
if: ${{ !cancelled() && steps.eslint.outcome != 'success' }}
8481
continue-on-error: true
85-
uses: ataylorme/eslint-annotate-action@v3
82+
uses: ataylorme/eslint-annotate-action@d57a1193d4c59cbfbf3f86c271f42612f9dbd9e9 # 3.0.0

.github/workflows/pull.yaml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "Pull"
22

33
on:
4-
pull_request:
4+
pull_request_target:
55

66
concurrency:
77
group: ${{ github.workflow }}-${{ github.ref }}
@@ -15,11 +15,36 @@ jobs:
1515

1616
permissions:
1717
pull-requests: write
18+
issues: write
1819

1920
steps:
20-
- name: "Checkout"
21+
- name: "Debug CTX github"
22+
continue-on-error: true
23+
env:
24+
GITHUB_CTX: ${{ toJSON(github) }}
25+
run: echo "$GITHUB_CTX"
26+
27+
- name: "Checkout Pull"
2128
uses: actions/checkout@v5
29+
with:
30+
ref: ${{ github.event.pull_request.head.sha }}
31+
32+
- name: "Debug"
33+
continue-on-error: true
34+
run: |
35+
echo "::group::ls"
36+
ls -lAh .
37+
echo "::endgroup::"
38+
echo "::group::tree"
39+
tree .
40+
echo "::endgroup::"
2241
2342
- name: "NPM Outdated Check"
2443
continue-on-error: true
2544
uses: cssnr/npm-outdated-action@master
45+
46+
- name: "Actions Up"
47+
continue-on-error: true
48+
uses: cssnr/actions-up-action@master
49+
with:
50+
exclude: "cssnr/.*,actions/.*"

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ jobs:
3737

3838
- name: "Send Failure Notification"
3939
if: ${{ failure() }}
40-
uses: sarisia/actions-status-discord@v1
40+
uses: sarisia/actions-status-discord@11a0bfe3b50977e38aa2bd4a4ebd296415e83c19 # v1.15.4
4141
with:
4242
webhook: ${{ secrets.DISCORD_WEBHOOK }}

.github/workflows/test.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ jobs:
2222
- name: "Checkout"
2323
uses: actions/checkout@v4
2424

25+
- name: "Debug CTX github"
26+
if: ${{ !github.event.act }}
27+
continue-on-error: true
28+
env:
29+
GITHUB_CTX: ${{ toJSON(github) }}
30+
run: echo "$GITHUB_CTX"
31+
2532
- name: "Test Local Action"
2633
id: test
2734
uses: ./

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ eslint_report.json
66
.env
77
.secrets
88
.vars
9+
.github/workflows/local.yaml

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[![GitHub Tag Minor](https://img.shields.io/github/v/tag/cssnr/json-key-value-check-action?sort=semver&filter=!v*.*.*&logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/json-key-value-check-action/releases)
33
[![GitHub Release Version](https://img.shields.io/github/v/release/cssnr/json-key-value-check-action?logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/json-key-value-check-action/releases/latest)
44
[![GitHub Dist Size](https://img.shields.io/github/size/cssnr/json-key-value-check-action/dist%2Findex.js?logo=bookstack&logoColor=white&label=dist%20size)](https://github.com/cssnr/json-key-value-check-action/blob/master/src/index.ts)
5+
[![Action Run Using](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcssnr%2Fjson-key-value-check-action%2Frefs%2Fheads%2Fmaster%2Faction.yml&query=%24.runs.using&logo=githubactions&logoColor=white&label=runs)](https://github.com/cssnr/json-key-value-check-action/blob/master/action.yml)
56
[![Workflow Release](https://img.shields.io/github/actions/workflow/status/cssnr/json-key-value-check-action/release.yaml?logo=cachet&label=release)](https://github.com/cssnr/json-key-value-check-action/actions/workflows/release.yaml)
67
[![Workflow Test](https://img.shields.io/github/actions/workflow/status/cssnr/json-key-value-check-action/test.yaml?logo=cachet&label=test)](https://github.com/cssnr/json-key-value-check-action/actions/workflows/test.yaml)
78
[![Workflow Lint](https://img.shields.io/github/actions/workflow/status/cssnr/json-key-value-check-action/lint.yaml?logo=cachet&label=lint)](https://github.com/cssnr/json-key-value-check-action/actions/workflows/lint.yaml)
@@ -34,12 +35,12 @@ Check that JSON Key's Values Match Provided Values.
3435
3536
## Inputs
3637

37-
| input | required | default | description |
38-
| --------- | :------: | ------- | ------------------------------ |
39-
| file | **Yes** | - | JSON File Path to Validate |
40-
| keys | **Yes** | - | Keys to Check, One per Line |
41-
| values | **Yes** | - | Values to Verify, One per Line |
42-
| seperator | - | `.` | Nested Key Seperator |
38+
| Input | Default | Description of the Input |
39+
| :-------- | :--------- | :-------------------------------------- |
40+
| file | _Required_ | JSON File Path to Validate |
41+
| keys | _Required_ | Keys to Check, One per Line |
42+
| values | _Required_ | Values to Verify, One per Line |
43+
| seperator | `.` | Nested Key Seperator |
4344

4445
For multiple `keys` and `values` use new lines with a yaml `|`.
4546

@@ -117,18 +118,19 @@ For more information, see the CSSNR [SUPPORT.md](https://github.com/cssnr/.githu
117118

118119
# Contributing
119120

121+
If you would like to submit a PR, please review the [CONTRIBUTING.md](#contributing-ov-file).
122+
120123
Please consider making a donation to support the development of this project
121124
and [additional](https://cssnr.com/) open source projects.
122125

123126
[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cssnr)
124127

125-
If you would like to submit a PR, please review the [CONTRIBUTING.md](#contributing-ov-file).
126-
127128
Additionally, you can support other GitHub Actions I have published:
128129

129130
- [Stack Deploy Action](https://github.com/cssnr/stack-deploy-action?tab=readme-ov-file#readme)
130131
- [Portainer Stack Deploy Action](https://github.com/cssnr/portainer-stack-deploy-action?tab=readme-ov-file#readme)
131132
- [Docker Context Action](https://github.com/cssnr/docker-context-action?tab=readme-ov-file#readme)
133+
- [Actions Up Action](https://github.com/cssnr/actions-up-action?tab=readme-ov-file#readme)
132134
- [VirusTotal Action](https://github.com/cssnr/virustotal-action?tab=readme-ov-file#readme)
133135
- [Mirror Repository Action](https://github.com/cssnr/mirror-repository-action?tab=readme-ov-file#readme)
134136
- [Update Version Tags Action](https://github.com/cssnr/update-version-tags-action?tab=readme-ov-file#readme)
@@ -151,6 +153,7 @@ Additionally, you can support other GitHub Actions I have published:
151153

152154
These actions are not published on the Marketplace, but may be useful.
153155

156+
- [cssnr/create-files-action](https://github.com/cssnr/create-files-action?tab=readme-ov-file#readme) - Create various files from templates.
154157
- [cssnr/draft-release-action](https://github.com/cssnr/draft-release-action?tab=readme-ov-file#readme) - Keep a draft release ready to publish.
155158
- [cssnr/env-json-action](https://github.com/cssnr/env-json-action?tab=readme-ov-file#readme) - Convert env file to json or vice versa.
156159
- [cssnr/push-artifacts-action](https://github.com/cssnr/push-artifacts-action?tab=readme-ov-file#readme) - Sync files to a remote host with rsync.
@@ -166,9 +169,9 @@ These actions are not published on the Marketplace, but may be useful.
166169
These are basic action templates that I use for creating new actions.
167170

168171
- [js-test-action](https://github.com/smashedr/js-test-action?tab=readme-ov-file#readme) - JavaScript
169-
- [py-test-action](https://github.com/smashedr/py-test-action?tab=readme-ov-file#readme) - Python
170172
- [ts-test-action](https://github.com/smashedr/ts-test-action?tab=readme-ov-file#readme) - TypeScript
171-
- [docker-test-action](https://github.com/smashedr/docker-test-action?tab=readme-ov-file#readme) - Docker Image
173+
- [py-test-action](https://github.com/smashedr/py-test-action?tab=readme-ov-file#readme) - Python (Dockerfile)
174+
- [docker-test-action](https://github.com/smashedr/docker-test-action?tab=readme-ov-file#readme) - Docker (Image)
172175

173176
Note: The `docker-test-action` builds, runs and pushes images to [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry).
174177

dist/index.js

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as fs from 'node:fs';
12
import require$$0 from 'os';
23
import require$$0$1 from 'crypto';
34
import require$$1 from 'fs';
@@ -27,7 +28,6 @@ import require$$6 from 'string_decoder';
2728
import require$$0$9 from 'diagnostics_channel';
2829
import require$$2$2 from 'child_process';
2930
import require$$6$1 from 'timers';
30-
import * as fs from 'node:fs';
3131

3232
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3333

@@ -1719,7 +1719,7 @@ function requireTimers () {
17191719
return timers;
17201720
}
17211721

1722-
var main = {exports: {}};
1722+
var main$1 = {exports: {}};
17231723

17241724
var sbmh;
17251725
var hasRequiredSbmh;
@@ -3257,7 +3257,7 @@ function requireUrlencoded () {
32573257
var hasRequiredMain;
32583258

32593259
function requireMain () {
3260-
if (hasRequiredMain) return main.exports;
3260+
if (hasRequiredMain) return main$1.exports;
32613261
hasRequiredMain = 1;
32623262

32633263
const WritableStream = require$$0$7.Writable;
@@ -3338,12 +3338,12 @@ function requireMain () {
33383338
this._parser.write(chunk, cb);
33393339
};
33403340

3341-
main.exports = Busboy;
3342-
main.exports.default = Busboy;
3343-
main.exports.Busboy = Busboy;
3341+
main$1.exports = Busboy;
3342+
main$1.exports.default = Busboy;
3343+
main$1.exports.Busboy = Busboy;
33443344

3345-
main.exports.Dicer = Dicer;
3346-
return main.exports;
3345+
main$1.exports.Dicer = Dicer;
3346+
return main$1.exports;
33473347
}
33483348

33493349
var constants$3;
@@ -27247,43 +27247,44 @@ function requireCore () {
2724727247

2724827248
var coreExports = requireCore();
2724927249

27250-
(async () => {
27251-
try {
27252-
const file = coreExports.getInput('file', { required: true });
27253-
console.log('file:', file);
27254-
const keys = coreExports.getInput('keys', { required: true }).split('\n');
27255-
console.log('keys:', keys);
27256-
const values = coreExports.getInput('values', { required: true }).split('\n');
27257-
console.log('values:', values);
27258-
const seperator = coreExports.getInput('seperator', {
27259-
required: true,
27260-
trimWhitespace: false,
27261-
});
27262-
console.log('seperator:', seperator);
27263-
if (keys.length !== values.length) {
27264-
return coreExports.setFailed('Keys and Values length are not equal.');
27250+
async function main() {
27251+
const file = coreExports.getInput('file', { required: true });
27252+
console.log('file:', file);
27253+
const keys = coreExports.getInput('keys', { required: true }).split('\n');
27254+
console.log('keys:', keys);
27255+
const values = coreExports.getInput('values', { required: true }).split('\n');
27256+
console.log('values:', values);
27257+
const seperator = coreExports.getInput('seperator', {
27258+
required: true,
27259+
trimWhitespace: false,
27260+
});
27261+
console.log('seperator:', seperator);
27262+
if (keys.length !== values.length) {
27263+
return coreExports.setFailed('Keys and Values length are not equal.');
27264+
}
27265+
const fileData = fs.readFileSync(file);
27266+
const data = JSON.parse(fileData.toString());
27267+
for (let i = 0; i < keys.length; i++) {
27268+
console.log(`--- ${i + 1}: ${keys[i]}: ${values[i]}`);
27269+
const key = keys[i].split(seperator);
27270+
console.log('key:', key);
27271+
const value = key.reduce((x, y) => x?.[y] ?? null, data);
27272+
console.log('value:', value);
27273+
if (values[i] == value) {
27274+
coreExports.info(`\u001b[32m"${values[i]}" == "${value}"`);
2726527275
}
27266-
const fileData = fs.readFileSync(file);
27267-
const data = JSON.parse(fileData.toString());
27268-
for (let i = 0; i < keys.length; i++) {
27269-
console.log(`--- ${i + 1}: ${keys[i]}: ${values[i]}`);
27270-
const key = keys[i].split(seperator);
27271-
console.log('key:', key);
27272-
const value = key.reduce((x, y) => x?.[y] ?? null, data);
27273-
console.log('value:', value);
27274-
if (values[i] == value) {
27275-
coreExports.info(`\u001b[32m"${values[i]}" == "${value}"`);
27276-
}
27277-
else {
27278-
coreExports.info(`\u001b[31;1m"${values[i]}" != "${value}"`);
27279-
return coreExports.setFailed('One or more values were not equal.');
27280-
}
27276+
else {
27277+
coreExports.info(`\u001b[31;1m"${values[i]}" != "${value}"`);
27278+
return coreExports.setFailed('One or more values were not equal.');
2728127279
}
27282-
coreExports.info(`\u001b[32;1mFinished Success`);
27283-
}
27284-
catch (e) {
27285-
console.log(e);
27286-
if (e instanceof Error)
27287-
coreExports.setFailed(e.message);
2728827280
}
27289-
})();
27281+
coreExports.info(`\u001b[32;1mFinished Success`);
27282+
}
27283+
try {
27284+
await main();
27285+
}
27286+
catch (e) {
27287+
console.log(e);
27288+
if (e instanceof Error)
27289+
coreExports.setFailed(e.message);
27290+
}

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import typescriptEslint from '@typescript-eslint/eslint-plugin'
33
import tsParser from '@typescript-eslint/parser'
44
import { defineConfig } from 'eslint/config'
55

6+
// noinspection JSCheckFunctionSignatures
67
export default defineConfig({
78
extends: [js.configs.recommended],
89
plugins: {

event.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"act": true
3+
}

0 commit comments

Comments
 (0)