-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Download artifact from openapi-generator fork
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Regenerate Tidal API module | ||
|
||
on: | ||
push: | ||
workflow_dispatch: # This workflow is manually triggered | ||
|
||
jobs: | ||
download-artifact: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Set up a checkout for the current repository (optional) | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Use GITHUB_TOKEN or PAT to authenticate the API request | ||
- name: Download artifact from another repo | ||
run: | | ||
# Set the repository, run ID, and artifact name | ||
REPO_OWNER="tidal-music" | ||
REPO_NAME="openapi-generator" | ||
ARTIFACT_NAME="openapi-generator-cli.jar" | ||
# Get the latest workflow run ID | ||
RUN_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/runs?per_page=1" | jq -r '.workflow_runs[0].id') | ||
# Get the artifact download URL | ||
ARTIFACT_URL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/runs/$RUN_ID/artifacts" | jq -r --arg ARTIFACT_NAME "$ARTIFACT_NAME" '.artifacts[] | select(.name == $ARTIFACT_NAME) | .archive_download_url') | ||
# Download the artifact and extract it | ||
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o artifact.zip "$ARTIFACT_URL" | ||
unzip artifact.zip -d ./artifact |