Reputation: 21
I have two private repository A and B and I Am trying to download artifact from repo A to B for which I am using REST API to fetch Artifact ID But some how I am not able to see the id
curl -L
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer "
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/repos/OWNER/REPO/actions/artifacts
-o artifact.json
I have used more artifact.json command to read content inside it but it isn't showing output neither throwing any error. I have already tried several command like cat and jq
I have used below command after giving up on fetching the id. It worked but the artifact format was url and that's why I was unable to unzip it.
curL -u ${{secrets.PAT_TOKEN}}
-L -o myartifact.zip
https:// api.github.com/repos/OWNER/REPO/actions/runs/${{github.run_id}}artifacts/zip
Please help me with this I've been pulling my hairs over this for quite a few days now. Please share what has worked for you.
Edit: Adding workflow jobs: build: runs_on: [self-hosted]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: JDK 11 setup
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'zulu'
- name: Download artifact
run: |
curL -u ${{secrets.PAT_TOKEN}} \
-L -o myartifact.zip \
https:// api.github.com/repos/OWNER/REPO/actions/runs/${{github.run_id}}artifacts/zip
- name: View artifact
run: file myartifact.zip #gave output that it's an url
- name: Artifact id #tried fetching to use it instead of runid
run: |
curl -L
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer "
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/repos/OWNER/REPO/actions/artifacts -o artifact.json
- name: View artifact file
run: |
file artifact.json #gave o/p that file is empty
Upvotes: 0
Views: 40