Access to Github workflow's artifacts

Viewed 785

I am new to the Github workflow and struggle a bit with downloading my artifact form completed workflow.

My workflow works well: build projects and upload an artifact

- name: 4. Store artifact in GitHub
  uses: actions/upload-artifact@v2
  with:
    name: my-artifact
    path: target/my-project.jar
    retention-days: 1
    if-no-files-found: error

After artifact is uploaded I trigger endpoint on my server that suppose to download & deploy my artifact.

- name: 5. Run deploy on server
  uses: fjogeleit/http-request-action@master
  with:
    url: 'my-endpoint'
    method: 'POST'
    contentType: application/x-www-form-urlencoded
    data: '{"run-id": "${{github.run_id}}", "repo": "${{github.repository}}", "secret": "${{ secrets.GITHUB_TOKEN }}"}'
    preventFailureOnNoResponse: 'true'

The artifact is available after workflow is completed and my server get requests to start deploy process.

The challenge I have right now is authorization. Initially I used my "Personal access token" to download file (and it worked), but that looks wrong (using my private token).

I tried to find if there is a temporary token (or anything like that) that would allow me to download my artifact from external server. I tried secrets.GITHUB_TOKEN but that did not work for me (or I used it wrong).

Here is how I check for artifacts: https://api.github.com/repos/${owner}/${repo}/actions/runs/${id}/artifacts

Could you please point how I can get my artifact from workflow without giving my private token?

Thanks.

0 Answers
Related