From e26873d29097f4eeb3c2f2a46de9d27b3b5fc3ca Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 6 Sep 2025 15:22:55 +0800 Subject: [PATCH] CI: Access DagsHub repository via an access token --- .github/workflows/ci_tests.yaml | 6 +++++- .github/workflows/ci_tests_dev.yaml | 6 +++++- .github/workflows/dvc-diff.yml | 4 ++++ .github/workflows/release-baseline-images.yml | 6 +++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index f461277121f..1b414420b25 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -163,7 +163,11 @@ jobs: # Pull baseline image data from dvc remote (DAGsHub) - name: Pull baseline image data from dvc remote - run: uv run dvc pull --no-run-cache --verbose && ls -lhR pygmt/tests/baseline/ + run: | + uv run dvc remote modify upstream url https://${DAGSHUB_TOKEN}@dagshub.com/GenericMappingTools/pygmt.dvc --local + uv run dvc pull --no-run-cache --verbose && ls -lhR pygmt/tests/baseline/ + env: + DAGSHUB_TOKEN: ${{ secrets.DAGSHUB_TOKEN }} # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index c3715df0e67..17e87886647 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -161,7 +161,11 @@ jobs: # Pull baseline image data from dvc remote (DAGsHub) - name: Pull baseline image data from dvc remote - run: dvc pull --no-run-cache --verbose && ls -lhR pygmt/tests/baseline/ + run: | + dvc remote modify upstream url https://${DAGSHUB_TOKEN}@dagshub.com/GenericMappingTools/pygmt.dvc --local + dvc pull --no-run-cache --verbose && ls -lhR pygmt/tests/baseline/ + env: + DAGSHUB_TOKEN: ${{ secrets.DAGSHUB_TOKEN }} # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub diff --git a/.github/workflows/dvc-diff.yml b/.github/workflows/dvc-diff.yml index e9afe3cd3b2..6610002cbf5 100644 --- a/.github/workflows/dvc-diff.yml +++ b/.github/workflows/dvc-diff.yml @@ -57,10 +57,14 @@ jobs: env: repo_token: ${{ github.token }} PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + DAGSHUB_TOKEN: ${{ secrets.DAGSHUB_TOKEN }} run: | echo -e "## Summary of changed images\n" > report.md echo -e "This is an auto-generated report of images that have changed on the DVC remote\n" >> report.md + # Configure DVC to use the DAGsHub remote via a token + dvc remote modify upstream url https://${DAGSHUB_TOKEN}@dagshub.com/GenericMappingTools/pygmt.dvc --local + # Pull image data from cloud storage dvc pull --remote upstream dvc diff --md main HEAD >> report.md diff --git a/.github/workflows/release-baseline-images.yml b/.github/workflows/release-baseline-images.yml index 050e031d897..004e572d73d 100644 --- a/.github/workflows/release-baseline-images.yml +++ b/.github/workflows/release-baseline-images.yml @@ -31,7 +31,11 @@ jobs: uses: iterative/setup-dvc@175771be1dc3d119268e00a896b52a4b77decb5e # v1.2.0 - name: Pull baseline image data from dvc remote - run: dvc pull && ls -lhR pygmt/tests/baseline/ + run: | + dvc remote modify upstream url https://${DAGSHUB_TOKEN}@dagshub.com/GenericMappingTools/pygmt.dvc --local + dvc pull && ls -lhR pygmt/tests/baseline/ + env: + DAGSHUB_TOKEN: ${{ secrets.DAGSHUB_TOKEN }} - name: Create the baseline image asset in zip format run: |