Skip to content

Commit f0c7124

Browse files
committed
feat: create export-secrets-action
1 parent f698798 commit f0c7124

18 files changed

+34765
-2
lines changed

Diff for: .eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

Diff for: .eslintrc.cjs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/** @type {import("eslint/lib/shared/types").ConfigData} */
2+
module.exports = {
3+
env: {
4+
es2021: true,
5+
node: true,
6+
},
7+
extends: [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"prettier",
11+
],
12+
overrides: [
13+
{
14+
env: {
15+
node: true,
16+
},
17+
files: [".eslintrc.{js,cjs}"],
18+
parserOptions: {
19+
sourceType: "script",
20+
},
21+
},
22+
],
23+
parser: "@typescript-eslint/parser",
24+
parserOptions: {
25+
ecmaVersion: "latest",
26+
sourceType: "module",
27+
},
28+
plugins: ["@typescript-eslint"],
29+
rules: {},
30+
};

Diff for: .github/workflows/actionlint.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: actionlint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
actionlint:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
15+
- name: Download actionlint
16+
id: get_actionlint
17+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
18+
shell: bash
19+
- name: Check workflow files
20+
run: ${{ steps.get_actionlint.outputs.executable }} -color
21+
shell: bash

Diff for: .github/workflows/ci.yml

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
15+
- name: Setup Node.js
16+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
17+
with:
18+
node-version-file: package.json
19+
cache: npm
20+
- name: Run npm ci
21+
run: npm ci
22+
- name: Build
23+
run: npm run build
24+
- name: Check diff
25+
run: |
26+
if ! git diff --no-patch --exit-code; then
27+
echo Diff found 1>&2
28+
exit 1
29+
fi
30+
31+
lint:
32+
runs-on: ubuntu-20.04
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
36+
- name: Setup Node.js
37+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
38+
with:
39+
node-version-file: package.json
40+
cache: npm
41+
- name: Run npm ci
42+
run: npm ci
43+
- name: Run ESLint
44+
run: npm run lint
45+
46+
format:
47+
runs-on: ubuntu-20.04
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
51+
- name: Setup Node.js
52+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
53+
with:
54+
node-version-file: package.json
55+
cache: npm
56+
- name: Run npm ci
57+
run: npm ci
58+
- name: Run Prettier format check
59+
run: npm run format:check
60+
61+
test-node:
62+
runs-on: ubuntu-20.04
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
66+
- name: Setup Node.js
67+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
68+
with:
69+
node-version-file: package.json
70+
cache: npm
71+
- name: Run npm ci
72+
run: npm ci
73+
- name: Test
74+
run: npm test
75+
76+
test-action:
77+
runs-on: ubuntu-20.04
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
81+
- name: Run export-secrets-action
82+
uses: ./
83+
with:
84+
secrets: '{"KEY_A":"VALUE_A","KEY_B":"VALUE_B","KEY_C":"VALUE_C"}'
85+
- name: Check environment variables
86+
run: |
87+
EXPECTED_VALUE_KEY_A='VALUE_A'
88+
EXPECTED_VALUE_KEY_B='VALUE_B'
89+
EXPECTED_VALUE_KEY_C='VALUE_C'
90+
91+
FAILED='false'
92+
93+
if [ "$KEY_A" = "$EXPECTED_VALUE_KEY_A" ]; then
94+
echo 'PASSED: VALUE_A'
95+
else
96+
echo 'FAILED: VALUE_A' 1>&2
97+
echo " expected: $EXPECTED_VALUE_KEY_A" 1>&2
98+
echo " actual: $KEY_A" 1>&2
99+
FAILED='true'
100+
fi
101+
102+
if [ "$KEY_B" = "$EXPECTED_VALUE_KEY_B" ]; then
103+
echo 'PASSED: VALUE_B'
104+
else
105+
echo 'FAILED: VALUE_B' 1>&2
106+
echo " expected: $EXPECTED_VALUE_KEY_B" 1>&2
107+
echo " actual: $KEY_B" 1>&2
108+
FAILED='true'
109+
fi
110+
111+
if [ "$KEY_C" = "$EXPECTED_VALUE_KEY_C" ]; then
112+
echo 'PASSED: VALUE_C'
113+
else
114+
echo 'FAILED: VALUE_C' 1>&2
115+
echo " expected: $EXPECTED_VALUE_KEY_C" 1>&2
116+
echo " actual: $KEY_C" 1>&2
117+
FAILED='true'
118+
fi
119+
120+
if [ "$FAILED" = 'true' ]; then
121+
exit 1
122+
fi

Diff for: .github/workflows/renovate-config-validator.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: renovate-config-validator
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
renovate-config-validator:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
15+
- name: Run renovate-config-validator
16+
uses: suzuki-shunsuke/github-action-renovate-config-validator@b54483862375f51910a60c4f498e927d4f3df466 # v1.0.1

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ out
8989

9090
# Nuxt.js build / generate output
9191
.nuxt
92-
dist
92+
# dist
9393

9494
# Gatsby files
9595
.cache/

Diff for: .prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

Diff for: README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
# export-secrets-action
1+
# export-secrets-action
2+
3+
Export GitHub Actions secrets as environment variables.
4+
5+
## Usage
6+
7+
```yml
8+
steps:
9+
- uses: koyashiro/[email protected]
10+
with:
11+
secrets: ${{ toJSON(secrets) }}
12+
```

Diff for: action.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: export-secrets-action
2+
author: koyashiro <[email protected]>
3+
description: Export GitHub Actions secrets as environment variables
4+
inputs:
5+
secrets:
6+
description: JSON representation of secrets
7+
required: true
8+
runs:
9+
using: node20
10+
main: dist/index.js

0 commit comments

Comments
 (0)