From 8385c3bbfadd2b9489141d40e70b3e34b6800e21 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 --- .github/workflows/ci.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1458893..9744c93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,11 +37,25 @@ jobs: with: toolchain: ${{ matrix.toolchain }} + - name: Resolve inputs.ref to full SHA + # https://github.com/actions/checkout/issues/265#issuecomment-1936792528 + id: resolve-ref + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ref=${{ matrix.ctru-rs-ref }} + sha=$(gh api /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