Hi, I am trying to use my Github secrets and pass ...
# dev-metaflow
s
Hi, I am trying to use my Github secrets and pass them over as my environment variables
Copy code
- name: Run Metaflow script
      env:
        WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
      
      run: |
        pipenv run python deploy.py run
However, seems like my secrets are not passed over to my modules. This is a part of my deploy.py file-
Copy code
@environment(vars={'WANDB_API_KEY': os.getenv('WANDB_API_KEY')})
    @step
    def ml_flow(self):
        from src import ModelOps
        import os
        print("Training model") 
        self.rf_reg = ModelOps.ModelFit()
        self.model = self.rf_reg.model(
            self.X_train, self.X_test, self.y_train, self.y_test
        )
        self.next(self.publishing_api)
Error-The API key you provided is either invalid or missing. Checked for the validity of my API. My key isnt getting through to my modules. What am I doing wrong? PS- I am using
Copy code
os.environ["WANDB_API_KEY"]  = os.getenv('WANDB_API_KEY')
inside my modelfit module to extract my api key value
h
maybe github actions doesn't doesn't pass it through to pipenv? try adding the explicit declaration of the variable in the run command maybe?
Copy code
run: |
  WANDB_API_KEY=${{ secrets.WANDB_API_KEY }} pipenv...