From 44fa8c7bd042907dd7bb9a42dbefdf1ad346c313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Gr=C3=A4sman?= Date: Sun, 18 Dec 2022 13:16:39 +0100 Subject: [PATCH] [ci] Upgrade to actions/checkout@v3 The v2 action depends on deprecated Node.js 12, as indicated by warning from GitHub Actions: Node.js 12 actions are deprecated. For more information see: [1]. Please update the following actions to use Node.js 16: actions/checkout@v2 (See [2] for an example.) Upgrade to actions/checkout@v3 to silence the warning. Unfortunately this new version has a very confusing policy for default checkout ref: "[...] the last merge commit of the pull request merge branch". There does not appear to be a convenient way to fall back to the v2 behavior. Add some conditional logic to resolve the HEAD of the right branch whether it's a schedule, push or pull_request event. [1] https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. [2] https://github.com/include-what-you-use/include-what-you-use/actions/runs/3718310359 --- .github/workflows/ci.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e45ce5f..1f6d1e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,8 +38,20 @@ jobs: libclang$LLVM_TAG-dev \ clang$LLVM_TAG - - name: Check out default branch - uses: actions/checkout@v2 + - name: Select checkout ref (PR) + if: github.event_name == 'pull_request' + run: | + echo "IWYU_CHECKOUT_REF=${{github.event.pull_request.head.sha}}" >> $GITHUB_ENV + + - name: Select checkout ref (push/schedule) + if: github.event_name == 'push' || github.event_name == 'schedule' + run: | + echo "IWYU_CHECKOUT_REF=${{github.sha}}" >> $GITHUB_ENV + + - name: Check out branch + uses: actions/checkout@v3 + with: + ref: ${{env.IWYU_CHECKOUT_REF}} - name: Build include-what-you-use run: |