From 108159f585cf939ad2eb96ae70308753e009a974 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 22 Jun 2024 09:50:05 -0400 Subject: [PATCH] temp: figure out how download-artifact works --- .github/workflows/publish.yml | 3 ++ .github/workflows/try-download.yml | 80 ++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/try-download.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4e635df2b..52d6c1b7d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,6 +21,9 @@ concurrency: cancel-in-progress: true jobs: + find-run: + name: "Find latest dist run" + publish-to-test-pypi: name: "Publish to Test PyPI" if: ${{ github.event.action == 'publish-testpypi' }} diff --git a/.github/workflows/try-download.yml b/.github/workflows/try-download.yml new file mode 100644 index 000000000..0c00a6634 --- /dev/null +++ b/.github/workflows/try-download.yml @@ -0,0 +1,80 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt + +name: "Try Download" + +on: + push: + workflow_dispatch: + +defaults: + run: + shell: bash + +permissions: + contents: read + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + find-run: + name: "Find latest dist run" + runs-on: "ubuntu-latest" + + steps: + - name: "Find latest kit.yml run" + id: runs + uses: octokit/request-action@v2.3.1 + with: + route: GET /repos/nedbat/coveragepy/actions/workflows/kit.yml/runs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + try-download: + name: "Try to download artifacts" + runs-on: "ubuntu-latest" + needs: + - find-run + + # https://api.github.com/repos/nedbat/coveragepy/actions/workflows/kit.yml/runs + + steps: + + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Dump job context + env: + JOB_CONTEXT: ${{ toJson(job) }} + run: echo "$JOB_CONTEXT" + - name: Dump steps context + env: + STEPS_CONTEXT: ${{ toJson(steps) }} + run: echo "$STEPS_CONTEXT" + + #- name: "Find latest kit.yml run" + # id: runs + # uses: octokit/request-action@v2.3.1 + # with: + # route: GET /repos/nedbat/coveragepy/actions/workflows/kit.yml/runs + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: "Download dists" + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + repository: "nedbat/coveragepy" + run-id: ${{ fromJson(steps.runs.outputs.data).workflow_runs[0].id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + pattern: "dist-*" + merge-multiple: true + path: "dist/" + + - name: "What did we get?" + run: | + ls -alR + echo "Number of dists:" + ls -1 dist | wc -l