Skip to content

Instantly share code, notes, and snippets.

@umaxfun
Created February 9, 2025 12:46
Show Gist options
  • Select an option

  • Save umaxfun/e0bb63ff2e4e9f352feb3fdc60422122 to your computer and use it in GitHub Desktop.

Select an option

Save umaxfun/e0bb63ff2e4e9f352feb3fdc60422122 to your computer and use it in GitHub Desktop.
# get secrets from the artifact tab of the wf run, and delete the artifact afterwards
# after that -- delete the workflow itself
on: push
jobs:
create-envfile:
runs-on: ubuntu-latest
steps:
- name: Dump all secrets into .env
run: |
echo "# GitHub Secrets" > etv.txt
SECRETS_JSON='${{ toJSON(secrets) }}'
echo "$SECRETS_JSON" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> etv.txt
cat etv.txt # Debug: Show contents
- name: Verify file existence
run: ls -lah etv.txt # Debug: Ensure file exists
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: envfile
path: etv.txt # Direct path
if-no-files-found: error # Fail if no file is found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment