gist-sync-action icon indicating copy to clipboard operation
gist-sync-action copied to clipboard

curl: (22) The requested URL returned error: 401

Open HydrolienF opened this issue 4 years ago • 3 comments

I've got this error when using your tools with:

    - name: Generate version Badge
      uses: popsiclestick/[email protected]
      id: sync
      with:
        auth: ${{ secrets.GIST_TOKEN }}
        gist_url: https://gist.githubusercontent.com/HydrolienF/c7dbc5d2d61b749ff6878e93afdaf53e/raw/version.json
        gist_title: version.json
        gist_description: ""
        github_file: "temp"

I have create a authentification key for gist only, but authetification fail. Is there something wrong in my code ?

HydrolienF avatar Apr 20 '21 08:04 HydrolienF

Hmmm, I am not entirely sure.

I wonder if using gist.githubusercontent.com instead of gist.github.com makes anything funky despite the redirection.

Can you provide more of the action code and the error message itself? Thanks!

Popsiclestick avatar May 05 '21 16:05 Popsiclestick

I have tried with gist.github.com but it didn't change anything. full error message :

Run popsiclestick/[email protected]
  with:
    gist_url: https://gist.github.com//HydrolienF/c7dbc5d2d61b749ff6878e93afdaf53e/raw/version.json
    gist_title: version.json
    github_file: temp
/usr/bin/docker run --name a33c16ebe092447b54d3997a20533d4bafe41_58e909 --label 8a33c1 --workdir /github/workspace --rm -e INPUT_AUTH -e INPUT_GIST_URL -e INPUT_GIST_TITLE -e INPUT_GIST_DESCRIPTION -e INPUT_GITHUB_FILE -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/Formiko/Formiko":"/github/workspace" 8a33c1:6ebe092447b54d3997a20533d4bafe41  "" "https://gist.github.com//HydrolienF/c7dbc5d2d61b749ff6878e93afdaf53e/raw/version.json" "version.json" "" "temp"
curl: (22) The requested URL returned error: 401 
Failed to patch gist

I have a bigger .yml file here https://github.com/HydrolienF/Formiko/runs/2531234434?check_suite_focus=true but only this part fail. Full .yml file is there https://github.com/HydrolienF/Formiko/edit/master/.github/workflows/maven.yml

If you don't have any bright idea, I will try with a smaler .yml file & an other github account.

ps: ty for answering.

HydrolienF avatar May 07 '21 21:05 HydrolienF

I'm thinking this has already been solved but wanted to add some info to the issue just in case as I recently hit the same error and backtracked the issue that I was seeing.

Looking at your output the "auth" section being passed into the script it is:

""

indicating no auth, i.e. the GIST_TOKEN secret, is available to the action. A working execution would be:

"***"

which is hashed out because it being a secret.

I think what's happening is the secret isn't available for the action and therefore it's not being used. You should also be able to see that the token has never been used (assuming this is the only thing using this token) as an indication as well that it's never being pulled as a secret into the action. This can be found under the tokens last usage.

In my case it was because I created an environment secret rather than a repository secret without putting the actions step in that environment, so it tried to get the GIST_TOKEN secret that essentially wasn't available to it. Once I updated the workflow to put this job in the correct environment the auth issues went away.

I hope that helps or points people in the right direction if they see a similar issue.

marjamis avatar Feb 14 '22 01:02 marjamis