mirror of
https://github.com/timheuer/base64-to-file
synced 2025-06-30 00:32:53 +02:00
Compare commits
112 commits
Author | SHA1 | Date | |
---|---|---|---|
|
604a8926a8 | ||
|
2f0d58e350 | ||
|
784a1a4a99 | ||
|
adaa40c0c5 | ||
|
940b03f02a | ||
|
ce53155905 | ||
|
f07c3a9557 | ||
|
d0e10fce50 | ||
|
ca9e30baf8 | ||
|
f50b750e3c | ||
|
291f322050 | ||
|
64eeb40ad3 | ||
|
d07824eea8 | ||
|
1475780677 | ||
|
ef24992625 | ||
|
66bd53590f | ||
|
e0b777b218 | ||
|
2b78fe4083 | ||
|
49a75d95a9 | ||
|
44214ac438 | ||
|
5e53f8a429 | ||
|
0e3c721e2a | ||
|
d5f02c8bfe | ||
|
0d79db8563 | ||
|
48657ba25c | ||
|
eb76074a5e | ||
|
047beb5579 | ||
|
7a19b8252f | ||
|
07b7f6e15e | ||
|
37d190d14a | ||
|
c4a5032944 | ||
|
5c5d0a6e27 | ||
|
5aa440ab5b | ||
|
c2311f1b61 | ||
|
378f695371 | ||
|
80909a7d0c | ||
|
77994fcb6d | ||
|
f67122ca80 | ||
|
6607cb88f7 | ||
|
e624ff48e8 | ||
|
f62ba1262a | ||
|
7f0112efd9 | ||
|
dc92ef2882 | ||
|
bddd02bc11 | ||
|
24bbf87a16 | ||
|
3001995831 | ||
|
97cc54aeec | ||
|
78a6ac9855 | ||
|
5bd9e57466 | ||
|
301f8c5221 | ||
|
af402b5724 | ||
|
e288d25876 | ||
|
7e2c96f2ea | ||
|
2d34558844 | ||
|
a9f59e9007 | ||
|
34ba5566b6 | ||
|
f7072bc0fb | ||
|
8681243550 | ||
|
594158dd47 | ||
|
7f3c211b18 | ||
|
622f962cfd | ||
|
3ff91d2f2d | ||
|
83c4b967d8 | ||
|
4945e9e8aa | ||
|
745dc3b201 | ||
|
27bb93104e | ||
|
e63de05973 | ||
|
7f50a59522 | ||
|
adc77ccbac | ||
|
7774b54607 | ||
|
27d72d1f9e | ||
|
2a502b9c17 | ||
|
712b1de0b8 | ||
|
618837e4f3 | ||
|
33b6378b5e | ||
|
82f25e4519 | ||
|
8a213e6923 | ||
|
e8eccda7a2 | ||
|
5913a3bcef | ||
|
312ab6eb8f | ||
|
2ef51d52bf | ||
|
d446dc84d8 | ||
|
ee996e4db4 | ||
|
1df9daf94e | ||
|
fcb123ef6c | ||
|
68fedaa82a | ||
|
5b10abf09e | ||
|
64291b71fa | ||
|
9253f25800 | ||
|
2fe614b534 | ||
|
df1fbeb5d3 | ||
|
2da77ba1a8 | ||
|
a0f3b3f8ee | ||
|
99f040e2e4 | ||
|
172da96a71 | ||
|
abc0a68901 | ||
|
fb839998d1 | ||
|
5313db3e7c | ||
|
a75dcdf3e4 | ||
|
6f59c66836 | ||
|
ddf9dac666 | ||
|
c473f25783 | ||
|
6d7769ba66 | ||
|
bb671ae424 | ||
|
ef27e1f194 | ||
|
5f8bf89247 | ||
|
2d21e7d7d8 | ||
|
a36b35cfe0 | ||
|
ca64385ae3 | ||
|
09b914ffe5 | ||
|
10416be100 | ||
|
3ab47b004c |
11 changed files with 12939 additions and 511 deletions
109
.all-contributorsrc
Normal file
109
.all-contributorsrc
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"README.md"
|
||||||
|
],
|
||||||
|
"imageSize": 100,
|
||||||
|
"commit": false,
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"login": "filipkowicz",
|
||||||
|
"name": "Michał Filipek",
|
||||||
|
"avatar_url": "https://avatars3.githubusercontent.com/u/4691550?v=4",
|
||||||
|
"profile": "https://github.com/filipkowicz",
|
||||||
|
"contributions": [
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "timheuer",
|
||||||
|
"name": "Tim Heuer",
|
||||||
|
"avatar_url": "https://avatars3.githubusercontent.com/u/4821?v=4",
|
||||||
|
"profile": "https://timheuer.com/blog/",
|
||||||
|
"contributions": [
|
||||||
|
"code",
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "tubone24",
|
||||||
|
"name": "tubone(Yu Otsubo)",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/9511227?v=4",
|
||||||
|
"profile": "https://portfolio.tubone-project24.xyz/",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "Ontokrat",
|
||||||
|
"name": "GG",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/23409319?v=4",
|
||||||
|
"profile": "https://github.com/Ontokrat",
|
||||||
|
"contributions": [
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "danielz-nenda",
|
||||||
|
"name": "Daniel Zarins",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/74965667?v=4",
|
||||||
|
"profile": "http://www.nenda.com",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "RobbieFrodsham",
|
||||||
|
"name": "Robbie Frodsham",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/47029725?v=4",
|
||||||
|
"profile": "https://github.com/RobbieFrodsham",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "Blarkdackbyte",
|
||||||
|
"name": "Basti",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/14968844?v=4",
|
||||||
|
"profile": "https://github.com/Blarkdackbyte",
|
||||||
|
"contributions": [
|
||||||
|
"bug",
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "CodemenschenAndroid",
|
||||||
|
"name": "Codemenschen Android",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/60087122?v=4",
|
||||||
|
"profile": "https://github.com/CodemenschenAndroid",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "awesomund",
|
||||||
|
"name": "Osmund Maheswaran",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/5211642?v=4",
|
||||||
|
"profile": "https://github.com/awesomund",
|
||||||
|
"contributions": [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "chenrui333",
|
||||||
|
"name": "Rui Chen",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/1580956?v=4",
|
||||||
|
"profile": "http://chenrui.dev",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"contributorsPerLine": 7,
|
||||||
|
"projectName": "base64-to-file",
|
||||||
|
"projectOwner": "timheuer",
|
||||||
|
"repoType": "github",
|
||||||
|
"repoHost": "https://github.com",
|
||||||
|
"skipCi": true,
|
||||||
|
"commitConvention": "angular",
|
||||||
|
"commitType": "docs"
|
||||||
|
}
|
22
.devcontainer/devcontainer.json
Normal file
22
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "Node.js & TypeScript",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/typescript-node:16-bullseye",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/sshd:1": {}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/implementors/features.
|
||||||
|
// "features": {},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
"postCreateCommand": "npm install"
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
// "customizations": {},
|
||||||
|
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
|
}
|
50
.github/workflows/test-matrix.yml
vendored
Normal file
50
.github/workflows/test-matrix.yml
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
name: "Action Test"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# test action works running from the graph
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Write file (1)
|
||||||
|
id: write_file
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
fileName: 'temp/dir/not/exists/myTemporaryFile.txt'
|
||||||
|
encodedString: ${{ secrets.SOME_ENCODED_STRING }} # SGVsbG8sIFdvcmxkIQ==
|
||||||
|
|
||||||
|
- name: Write file (2)
|
||||||
|
id: write_file2
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
fileName: 'myTemporaryFile.json'
|
||||||
|
encodedString: ${{ secrets.ENCODED_JSON }}
|
||||||
|
|
||||||
|
- name: Echo file
|
||||||
|
run: |
|
||||||
|
echo ${{ steps.write_file.outputs.filePath }}
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: 'final-file-${{ matrix.os }}.txt'
|
||||||
|
path: ${{ steps.write_file.outputs.filePath }}
|
||||||
|
|
||||||
|
- name: Upload Artifact 2
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: 'final-file-${{ matrix.os }}.json'
|
||||||
|
path: ${{ steps.write_file2.outputs.filePath }}
|
27
.github/workflows/test.yml
vendored
27
.github/workflows/test.yml
vendored
|
@ -1,27 +0,0 @@
|
||||||
name: "Action Test"
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# test action works running from the graph
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
- name: Run Workflow
|
|
||||||
id: write_file
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
fileName: 'myTemporaryFile.txt'
|
|
||||||
encodedString: ${{ secrets.SOME_ENCODED_STRING }} # SGVsbG8sIFdvcmxkIQ==
|
|
||||||
- name: Echo file
|
|
||||||
run: |
|
|
||||||
echo ${{ steps.write_file.outputs.filePath }}
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@master
|
|
||||||
with:
|
|
||||||
name: 'final-file.txt'
|
|
||||||
path: ${{ steps.write_file.outputs.filePath }}
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@ node_modules/
|
||||||
|
|
||||||
# Editors
|
# Editors
|
||||||
.vscode
|
.vscode
|
||||||
|
.vs/
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
|
|
55
README.md
55
README.md
|
@ -1,4 +1,7 @@
|
||||||
# Base64 to File
|
# Base64 to File
|
||||||
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||||
|
[](#contributors-)
|
||||||
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||||
|
|
||||||
Use this action if you need to get a file from a base64-encoded string that you may be storing in Secrets or elsewhere. This can be useful for certificate signing and storing the base64 cert in the Secrets.
|
Use this action if you need to get a file from a base64-encoded string that you may be storing in Secrets or elsewhere. This can be useful for certificate signing and storing the base64 cert in the Secrets.
|
||||||
|
|
||||||
|
@ -7,19 +10,20 @@ Use this action if you need to get a file from a base64-encoded string that you
|
||||||
```
|
```
|
||||||
- name: Run Workflow
|
- name: Run Workflow
|
||||||
id: write_file
|
id: write_file
|
||||||
uses: timheuer/base64-to-file@v1
|
uses: timheuer/base64-to-file@v1.2
|
||||||
with:
|
with:
|
||||||
fileName: 'myTemporaryFile.txt'
|
fileName: 'myTemporaryFile.txt'
|
||||||
|
fileDir: './main/folder/subfolder/'
|
||||||
encodedString: ${{ secrets.SOME_ENCODED_STRING }}
|
encodedString: ${{ secrets.SOME_ENCODED_STRING }}
|
||||||
```
|
```
|
||||||
|
By default this writes the `fileName` to a temporary path defined by `env.RUNNER_TEMP`. If you want a different path that is writable, specify `fileDir` as an input argument as well and then `fileDir` and `fileName` will be combined to create the path where the output will be written. This assumes permissions in the `fileDir` are correct and does not try to set them.
|
||||||
## Using the file in a later step
|
## Using the file in a later step
|
||||||
The Action has an output variable named filePath that you can use as this file is written to TEMP. Make sure you ad an `id` to your step when using this Action so that you can easily pull it out of the steps context later.
|
The Action has an output variable named filePath that you can use as this file is written to TEMP. Make sure you ad an `id` to your step when using this Action so that you can easily pull it out of the steps context later.
|
||||||
|
|
||||||
```
|
```
|
||||||
- name: Run Workflow
|
- name: Run Workflow
|
||||||
id: write_file
|
id: write_file
|
||||||
uses: timheuer/base64-to-file@v1
|
uses: timheuer/base64-to-file@v1.2
|
||||||
with:
|
with:
|
||||||
fileName: 'myTemporaryFile.txt'
|
fileName: 'myTemporaryFile.txt'
|
||||||
encodedString: ${{ secrets.SOME_ENCODED_STRING }}
|
encodedString: ${{ secrets.SOME_ENCODED_STRING }}
|
||||||
|
@ -29,3 +33,48 @@ The Action has an output variable named filePath that you can use as this file i
|
||||||
with:
|
with:
|
||||||
filelocation: ${{ steps.write_file.outputs.filePath }}
|
filelocation: ${{ steps.write_file.outputs.filePath }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Using this in a reusable workflow
|
||||||
|
As a special note, when using reusable workflows, repository secrets do not naturally 'flow' through to the workflow. So if your `encodedString` value is a repository secret and you expect this to work when this action is used in a reusable workflow, you need to specify the `secrets: inherit` value in that situation and put that where you are reusing this workflow.
|
||||||
|
|
||||||
|
## Building this repo
|
||||||
|
After making modifications to the source index.js file, to properly package the change you need to run
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run package
|
||||||
|
```
|
||||||
|
|
||||||
|
which will modify/create the /dist folder with the final index.js output
|
||||||
|
|
||||||
|
## Contributors ✨
|
||||||
|
|
||||||
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
||||||
|
|
||||||
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
<!-- markdownlint-disable -->
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/filipkowicz"><img src="https://avatars3.githubusercontent.com/u/4691550?v=4?s=100" width="100px;" alt="Michał Filipek"/><br /><sub><b>Michał Filipek</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/commits?author=filipkowicz" title="Documentation">📖</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://timheuer.com/blog/"><img src="https://avatars3.githubusercontent.com/u/4821?v=4?s=100" width="100px;" alt="Tim Heuer"/><br /><sub><b>Tim Heuer</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/commits?author=timheuer" title="Code">💻</a> <a href="https://github.com/timheuer/base64-to-file/commits?author=timheuer" title="Documentation">📖</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://portfolio.tubone-project24.xyz/"><img src="https://avatars.githubusercontent.com/u/9511227?v=4?s=100" width="100px;" alt="tubone(Yu Otsubo)"/><br /><sub><b>tubone(Yu Otsubo)</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/commits?author=tubone24" title="Code">💻</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Ontokrat"><img src="https://avatars.githubusercontent.com/u/23409319?v=4?s=100" width="100px;" alt="GG"/><br /><sub><b>GG</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/commits?author=Ontokrat" title="Documentation">📖</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="http://www.nenda.com"><img src="https://avatars.githubusercontent.com/u/74965667?v=4?s=100" width="100px;" alt="Daniel Zarins"/><br /><sub><b>Daniel Zarins</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/issues?q=author%3Adanielz-nenda" title="Bug reports">🐛</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RobbieFrodsham"><img src="https://avatars.githubusercontent.com/u/47029725?v=4?s=100" width="100px;" alt="Robbie Frodsham"/><br /><sub><b>Robbie Frodsham</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/issues?q=author%3ARobbieFrodsham" title="Bug reports">🐛</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Blarkdackbyte"><img src="https://avatars.githubusercontent.com/u/14968844?v=4?s=100" width="100px;" alt="Basti"/><br /><sub><b>Basti</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/issues?q=author%3ABlarkdackbyte" title="Bug reports">🐛</a> <a href="https://github.com/timheuer/base64-to-file/commits?author=Blarkdackbyte" title="Code">💻</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/CodemenschenAndroid"><img src="https://avatars.githubusercontent.com/u/60087122?v=4?s=100" width="100px;" alt="Codemenschen Android"/><br /><sub><b>Codemenschen Android</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/issues?q=author%3ACodemenschenAndroid" title="Bug reports">🐛</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/awesomund"><img src="https://avatars.githubusercontent.com/u/5211642?v=4?s=100" width="100px;" alt="Osmund Maheswaran"/><br /><sub><b>Osmund Maheswaran</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/issues?q=author%3Aawesomund" title="Bug reports">🐛</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="http://chenrui.dev"><img src="https://avatars.githubusercontent.com/u/1580956?v=4?s=100" width="100px;" alt="Rui Chen"/><br /><sub><b>Rui Chen</b></sub></a><br /><a href="https://github.com/timheuer/base64-to-file/commits?author=chenrui333" title="Code">💻</a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- markdownlint-restore -->
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||||
|
|
||||||
|
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
||||||
|
|
|
@ -8,6 +8,9 @@ inputs:
|
||||||
description: 'Name of the file when written to temp location'
|
description: 'Name of the file when written to temp location'
|
||||||
required: true
|
required: true
|
||||||
default: 'decoded-file.file'
|
default: 'decoded-file.file'
|
||||||
|
fileDir:
|
||||||
|
description: 'If it is set, change the output location to specific one from temp location.'
|
||||||
|
required: false
|
||||||
encodedString:
|
encodedString:
|
||||||
description: 'The base64 encoded string'
|
description: 'The base64 encoded string'
|
||||||
required: true
|
required: true
|
||||||
|
@ -15,5 +18,5 @@ outputs:
|
||||||
filePath:
|
filePath:
|
||||||
description: 'The temp file location'
|
description: 'The temp file location'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|
5860
dist/index.js
vendored
5860
dist/index.js
vendored
File diff suppressed because it is too large
Load diff
19
index.js
19
index.js
|
@ -1,22 +1,29 @@
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
const fs = require('fs');
|
const fse = require('fs-extra')
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
// get input parameter values from config
|
// get input parameter values from config
|
||||||
var fileName = process.env.RUNNER_TEMP + '\\' + core.getInput('fileName');
|
var fileName;
|
||||||
|
if (core.getInput('fileDir', {required: false})) {
|
||||||
|
fileName = path.join(core.getInput('fileDir'), core.getInput('fileName', {required: false}));
|
||||||
|
} else {
|
||||||
|
fileName = path.join(process.env.RUNNER_TEMP,core.getInput('fileName'));
|
||||||
|
}
|
||||||
|
|
||||||
var encodedString = core.getInput('encodedString');
|
var encodedString = core.getInput('encodedString');
|
||||||
|
|
||||||
// most @actions toolkit packages have async methods
|
// most @actions toolkit packages have async methods
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
console.log(process.env);
|
core.debug(process.env);
|
||||||
const tempFile = Buffer.from(encodedString, 'base64');
|
const tempFile = Buffer.from(encodedString, 'base64');
|
||||||
|
|
||||||
if (tempFile.length == 0)
|
if (tempFile.length == 0)
|
||||||
core.setFailed('Certificate value is not set');
|
core.setFailed('encodedString value is not set');
|
||||||
|
|
||||||
fs.writeFile(fileName, tempFile, (err) => {
|
fse.outputFile(fileName, tempFile, (err) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
console.log('Wrote file!');
|
core.debug('Wrote file!');
|
||||||
});
|
});
|
||||||
|
|
||||||
core.setOutput('filePath', fileName);
|
core.setOutput('filePath', fileName);
|
||||||
|
|
6891
package-lock.json
generated
6891
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "base64-to-file",
|
"name": "base64-to-file",
|
||||||
"version": "1.0.0",
|
"version": "1.2.4",
|
||||||
"description": "base64 encoded string to a file",
|
"description": "base64 encoded string to a file",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -25,10 +25,11 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/timheuer/base64-to-file#readme",
|
"homepage": "https://github.com/timheuer/base64-to-file#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.1.1"
|
"@actions/core": "^1.10.0",
|
||||||
|
"fs-extra": "^9.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@zeit/ncc": "^0.20.5",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"eslint": "^6.3.0",
|
"eslint": "^6.3.0",
|
||||||
"jest": "^24.9.0"
|
"jest": "^24.9.0"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue