From 59851fd001be30cd99e21b98a792a9c1f76ae516 Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Sun, 21 Apr 2024 16:26:24 -0400 Subject: [PATCH] Resolve short sha when checking out ctru-rs The devkitarm container doesn't have `gh` so we just make a raw API query, and because the repo is public we don't need a token. --- .github/workflows/ci.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1458893..92a318d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,11 +37,26 @@ jobs: with: toolchain: ${{ matrix.toolchain }} + - name: Resolve inputs.ref to full SHA + # https://github.com/actions/checkout/issues/265#issuecomment-1936792528 + id: resolve-ref + run: | + apt-get update -y && apt-get install -y jq + + ref=${{ matrix.ctru-rs-ref }} + sha=$(curl -L "https://api.github.com/repos/rust3ds/ctru-rs/commits/$ref" | jq -r .sha) + if [ -z "$sha" ]; then + echo "Failed to resolve ref $ref (possibly missing GH_TOKEN env var?)" >&2 + exit 1 + fi + + echo "sha=$sha" >> $GITHUB_OUTPUT + - uses: actions/checkout@v4 with: repository: 'rust3ds/ctru-rs' path: 'ctru-rs' - ref: ${{ matrix.ctru-rs-ref }} + ref: ${{ steps.resolve-ref.outputs.sha }} - name: Build and run tests (unit + integration) uses: ./run-tests