Go to file
Tim Heuer 604a8926a8
Merge pull request #57 from chenrui333/fix-workflow-to-match-with-default-branch
[skip ci]
2023-11-09 08:33:35 -08:00
.devcontainer Adding devcontainer [skip ci] 2022-11-16 15:41:42 -07:00
.github/workflows fix: update branch trigger to match with default branch change 2023-11-09 08:43:32 -05:00
dist feat: use node20 and upgrade ncc 2023-11-08 12:25:23 -05:00
.all-contributorsrc docs: update .all-contributorsrc [skip ci] 2023-11-08 18:27:05 +00:00
.eslintrc.json Initial commit 2019-12-14 13:10:21 -08:00
.gitignore Modifying version and error message 2023-05-17 09:45:07 -07:00
LICENSE Initial commit 2019-12-14 13:10:21 -08:00
README.md docs: update README.md [skip ci] 2023-11-08 18:27:04 +00:00
action.yml feat: use node20 and upgrade ncc 2023-11-08 12:25:23 -05:00
index.js make input error more descriptive 2023-05-17 18:01:28 +02:00
package-lock.json Modified version 2023-11-08 11:56:07 -07:00
package.json Modified version 2023-11-08 11:56:07 -07:00

README.md

Base64 to File

All Contributors

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.

Usage

- name: Run Workflow
  id: write_file
  uses: timheuer/base64-to-file@v1.2
  with:
    fileName: 'myTemporaryFile.txt'
    fileDir: './main/folder/subfolder/'
    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

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
  id: write_file
  uses: timheuer/base64-to-file@v1.2
  with:
    fileName: 'myTemporaryFile.txt'
    encodedString: ${{ secrets.SOME_ENCODED_STRING }}

- name: Some other step
  uses: actions/someaction@master
  with:
      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):

Michał Filipek
Michał Filipek

📖
Tim Heuer
Tim Heuer

💻 📖
tubone(Yu Otsubo)
tubone(Yu Otsubo)

💻
GG
GG

📖
Daniel Zarins
Daniel Zarins

🐛
Robbie Frodsham
Robbie Frodsham

🐛
Basti
Basti

🐛 💻
Codemenschen Android
Codemenschen Android

🐛
Osmund Maheswaran
Osmund Maheswaran

🐛
Rui Chen
Rui Chen

💻

This project follows the all-contributors specification. Contributions of any kind welcome!