Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected input(s) #10

Closed
umithyo opened this issue Jan 29, 2021 · 15 comments · Fixed by #17
Closed

Unexpected input(s) #10

umithyo opened this issue Jan 29, 2021 · 15 comments · Fixed by #17
Labels
documentation Improvements or additions to documentation

Comments

@umithyo
Copy link

umithyo commented Jan 29, 2021

image
I'm getting this error with the example provided. Any ideas how to solve it? Am I doing something wrong?

@davidsarkany
Copy link

davidsarkany commented Jan 30, 2021

I have same warning message.
https://github.com/davidsarkany/sts-backend/actions/runs/523191085

@dherbst
Copy link

dherbst commented Feb 3, 2021

This is because from https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action#creating-an-action-metadata-file

To pass inputs to the Docker container, you must declare the input using inputs and pass the input in the args keyword.

inputs is missing in the file: https://github.com/SpicyPizza/create-envfile/blob/master/action.yml

You can ignore the warning for now.

One way to avoid the warning is to find a way to pass the values as a defined input - but this would change the way this action works.

@proftom
Copy link

proftom commented Feb 18, 2021

OK so the problem is because we are using docker? @dherbst, I did not understand what the fix should be, nor your final sentence. Can you please give an example?

I wanted to use this action so I could create an .env file in the same directory as my app (where my sources and docker files are), just like I would have on my local dev box. Does this action not do this?

@dherbst
Copy link

dherbst commented Feb 18, 2021

@proftom this is not an error, it is a warning. You can ignore the warning, the action will work when github runs it because the python file looks for environment variables with INPUT_ as a prefix. You can see this here https://github.com/SpicyPizza/create-envfile/blob/master/src/create-envfile.py#L7-L9

I wanted to use this action so I could create an .env file in the same directory as my app (where my sources and docker files are), just like I would have on my local dev box. Does this action not do this?

The action does this for environment variables you name beginning with: envkey_ as stated in the https://github.com/SpicyPizza/create-envfile/blob/master/README.md

@AngelOnFira
Copy link
Member

Hmm I suppose the best course of action for this is to just document the behaviour in the Readme, as it seems that I can't add a wildcard to the expected input. If there are any other suggestions I'd be down to explore alternatives.

@AustinSpinazze
Copy link

AustinSpinazze commented May 20, 2021

I am also having this issue currently and it does have a warning, but github actions will not allow it to progress any further. Is there something I am doing wrong with the properties I am using?

        uses: SpicyPizza/[email protected]
        with:
            envkey_EMAILJS_USER_ID: ${{secrets.EMAILJS_USER_ID}}
            envkey_EMAILJS_SERVICE_ID : ${{ secrets.EMAILJS_SERVICE_ID }}
            envkey_EMAILJS_TEMPLATE_ID: ${{ secrets.EMAILJS_TEMPLATE_ID }}

Error I am receiving in action

Warning: Unexpected input(s) 'envkey_EMAILJS_USER_ID', 'envkey_EMAILJS_SERVICE_ID', 'envkey_EMAILJS_TEMPLATE_ID', valid inputs are ['entryPoint', 'args', 'file_name', 'directory']
Run SpicyPizza/[email protected]
/usr/bin/docker run --name a33c13ec0263ae54f490587719c522c9ca1b8_624e40 --label 8a33c1 --workdir /github/workspace --rm -e INPUT_ENVKEY_EMAILJS_USER_ID -e INPUT_ENVKEY_EMAILJS_SERVICE_ID -e INPUT_ENVKEY_EMAILJS_TEMPLATE_ID -e INPUT_FILE_NAME -e INPUT_DIRECTORY -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/ReactPersonalPortfolio/ReactPersonalPortfolio":"/github/workspace" 8a33c1:3ec0263ae54f490587719c522c9ca1b8
Traceback (most recent call last):
  File "/create-envfile.py", line 22, in <module>
    with open(os.path.join(path, directory, file_name), "w") as text_file:
FileNotFoundError: [Errno 2] No such file or directory: 'None/.env'

@khannakshat7
Copy link

I am facing issues with creating .env file. I am deploying my project using Google app engine. The project gets deployed but .env file is not created. Can you please help me with the issue.

This is my main.yaml file-

name: CI

on:
  push:
    branches: [ deploy ]
  pull_request:
    branches: [ deploy ]
  
jobs:
  create-envfile:
    runs-on: ubuntu-18.04
    steps:
      - name: Make envfile
        uses: SpicyPizza/create-envfile@v1
        with:
          envkey_DEBUG: False
          envkey_DATABASE_URL: ${{ secrets.DATABASE_URL }}
          envkey_USER: ${{ secrets.USER }}
          envkey_PASSWORD: ${{ secrets.PASSWORD }}
          envkey_DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
          file_name: .env

  
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Initialize Google Cloud SDK
        uses: zxyle/publish-gae-action@master
        with:
          service_account_email: ${{ secrets.GCP_SA_EMAIL }}
          service_account_key: ${{ secrets.GCP_SA_KEY }}
          project_id: ${{ secrets.PROJECT_ID }}
          gae_variables: ${{ secrets.GAE_VARIABLES }}

      - name: Publish app to Google App Engine
        run: |
          gcloud auth activate-service-account ${{ secrets.GCP_SA_EMAIL }} --key-file=client-secret.json
          gcloud config set project ${{ secrets.PROJECT_ID }}
          gcloud -q app deploy app.yaml --promote

Please check the output at https://github.com/khannakshat7/Elektra/actions/runs/888591866

@khannakshat7
Copy link

@AngelOnFira

@ZinatSayyad
Copy link

ZinatSayyad commented Feb 16, 2022

I am facing issue while creating .env file
image
Traceback (most recent call last):
File "/opt/action/create-envfile.py", line 38, in
raise Exception("Absolute paths are not allowed. Please use a relative path.")
Exception: Absolute paths are not allowed. Please use a relative path. Please help to resolvee the issue @AngelOnFira

@amatiash
Copy link

You could just use echo:

      - name: Create .env
        run: echo "API_KEY=${{ secrets.API_KEY }}" > .env

@umithyo
Copy link
Author

umithyo commented Mar 11, 2023

You could just use echo:

      - name: Create .env
        run: echo "API_KEY=${{ secrets.API_KEY }}" > .env

This kills the whole purpose of this action.

@mauriciabad
Copy link

Improving on this solution:

Just create a secret with the whole env file and create the file directly:

      - name: Create .env file
        run: echo "${{ secrets.PROD_FULL_ENV_FILE }}" > .env

@rodshtein
Copy link

You can also adds many keys to .env by used two arrows instead of one: >>

run:  |
  echo "USER=${{ secrets.USER }}" >> .env
  echo "PASS=${{ secrets.PASS }}" >> .env

@kralphs
Copy link

kralphs commented Feb 1, 2024

Improving on this solution:

Just create a secret with the whole env file and create the file directly:

      - name: Create .env file
        run: echo "${{ secrets.PROD_FULL_ENV_FILE }}" > .env

Having structured data in a secret impedes Github's abilities to redact sensitive information from logging. This approach is not advised

@joshmedeski
Copy link

What if a JSON input was supported?

with:
  envkeys: |
    {
      "DEBUG": false,
      "SOME_API_KEY": "123456abcdef",
      "SECRET_KEY": "${{ secrets.SECRET_KEY }}",
      "VARIABLE": "${{ vars.SOME_ACTION_VARIABLE }}"
    }

Perhaps keep backwards compatibility but add this as a new feature in v3 and let people update to this format if they wish to get rid of the warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.