From 8ac9e0b382e3caa5479819f8419331e89ff3e860 Mon Sep 17 00:00:00 2001 From: Dan Rivett Date: Sat, 22 Feb 2020 21:47:43 -0800 Subject: [PATCH] (#1) Attempting to fix an issue where commitlint couldn't validate the commit messages because the PR branch was checked out as a detached head. The error we received is below: error running commitlint fatal: ambiguous argument '46bb5821095a7e8e1ffd48f4697eec3c593c9b24^1..46bb5821095a7e8e1ffd48f4697eec3c593c9b24': unknown revision or path not in the working tree. This was solved using a solution reported here: https://github.com/actions/checkout/issues/124#issuecomment-586664611 --- .github/workflows/validate-pr.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index a70a310..1d856c0 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -11,9 +11,12 @@ jobs: steps: - name: Check out Git repository uses: actions/checkout@v2 - # We don't just checkout the last commit, but all commits - # This is so the commitlint GitHub Action below can lint commit messages with: + # Checkout the PR branch to avoid detached heads as seems to break the commitlint action + # See: https://github.com/actions/checkout/issues/124#issuecomment-586664611 + ref: ${{ github.event.pull_request.head.ref }} + # We don't just checkout the last commit, but all commits + # This is so the commitlint GitHub Action below can lint commit messages fetch-depth: 0 - name: Set up Node.js