Skip to content

Take a base64 string and decodes to a file for use in arguments in later actions.

License

Notifications You must be signed in to change notification settings

segesdk/base64-to-file

 
 

Repository files navigation

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: segesdk/[email protected]
  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: segesdk/[email protected]
  with:
    fileName: 'myTemporaryFile.txt'
    encodedString: ${{ secrets.SOME_ENCODED_STRING }}

- name: Some other step
  uses: actions/someaction@master
  with:
      filelocation: ${{ steps.write_file.outputs.filePath }}

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

📖

Tim Heuer

💻 📖

tubone(Yu Otsubo)

💻

GG

📖

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

About

Take a base64 string and decodes to a file for use in arguments in later actions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%