sourcery-ai / action

A GitHub Action for running Sourcery.
MIT License
26 stars 2 forks source link

how to run the workflow on forks #6

Open Karim-53 opened 1 year ago

Karim-53 commented 1 year ago

Hi

the secret token is not passed to PR based on forks

##[debug]....Evaluating String:
##[debug]....=> 'token'
##[debug]..=> ''
##[debug]=> 'sourcery login --token 
##[debug]'
##[debug]Result: 'sourcery login --token 
##[debug]'
##[debug]Loading env
Run sourcery login --token 
  sourcery login --token 
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.10.9/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.9/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.9/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.9/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.9/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.9/x64/lib
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/bb6c9ab8-c01e-48d9-9315-ce093cdd696f.sh
Error: Option '--token' requires an argument.
Error: Process completed with exit code 2.

this is because Secrets are not passed to workflows that are triggered by a pull request from a fork. [Learn more about encrypted secrets](https://docs.github.com/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets).

I tried on: pull_request_target but it does not work... https://github.com/Karim-53/Compare-xAI/blob/main/.github/workflows/sourcery.yml

https://github.com/Karim-53/Compare-xAI/actions/runs/3742105178

plz help

namurphy commented 1 year ago

I'm getting a similar error on https://github.com/PlasmaPy/PlasmaPy/pull/2220, which includes:

Error: Option '--token' requires an argument.

I made a pull request from a fork, and set up SOURCERY_TOKEN on the primary repo. I'll try to post here or on that PR if I figure out what the issue is. (I might try setting the token on my fork as well.)