From 38f016a3c5acb9d2c9a2399582d90ea4c5201a40 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 2 Jul 2021 12:23:49 +0200 Subject: [PATCH 1/4] Fix: [Actions] use prepared actions instead of custom shell-script --- .github/workflows/commit-checker.yml | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/.github/workflows/commit-checker.yml b/.github/workflows/commit-checker.yml index 805112a..acf622a 100644 --- a/.github/workflows/commit-checker.yml +++ b/.github/workflows/commit-checker.yml @@ -15,30 +15,7 @@ jobs: fetch-depth: 4 - name: Get pull-request commits - run: | - # actions/checkout did a merge checkout of the pull-request. As such, the first - # commit is the merge commit. This means that on HEAD^ is the base branch, and - # on HEAD^2 are the commits from the pull-request. We now check if those trees - # have a common parent. If not, we fetch a few more commits till we do. In result, - # the log between HEAD^ and HEAD^2 will be the commits in the pull-request. - DEPTH=4 - while [ -z "$(git merge-base HEAD^ HEAD^2)" ]; do - git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --deepen=${DEPTH} origin HEAD - DEPTH=$(( ${DEPTH} * 4 )) - done - - # Just to show which commits we are going to evaluate. - echo "Commits in this pull-request:" - git log --oneline HEAD^..HEAD^2 - - - name: Checkout commit-checker - uses: actions/checkout@v2 - with: - repository: OpenTTD/OpenTTD-git-hooks - path: git-hooks - ref: master + uses: OpenTTD/actions/checkout-pull-request@v2 - name: Check commits - run: | - HOOKS_DIR=./git-hooks/hooks GIT_DIR=.git ./git-hooks/hooks/check-commits.sh HEAD^..HEAD^2 - echo "Commit checks passed" + uses: OpenTTD/OpenTTD-git-hooks@main From ec00d32abb1fb20476939d8628918586c0443e4e Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 2 Jul 2021 12:23:53 +0200 Subject: [PATCH 2/4] Fix: [Actions] CodeQL can now run on the merge commit --- .github/workflows/testing.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 950de38..8476824 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -5,6 +5,8 @@ on: branches: - master pull_request: + branches: + - master jobs: codeql: @@ -13,14 +15,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - with: - # Must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head of the pull request. - fetch-depth: 2 - # If this run was triggered by a pull request event then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - name: Set up Python 3.8 uses: actions/setup-python@v1 with: From 0245bafbabcdb0f05a31c7dfb9ee1fd376e92a8e Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 2 Jul 2021 12:23:57 +0200 Subject: [PATCH 3/4] Fix: [Actions] switch to v2 for actions-flake8 --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 8476824..5a6c0c8 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -36,7 +36,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Flake8 - uses: TrueBrain/actions-flake8@master + uses: TrueBrain/actions-flake8@v2 with: path: examples openttd_helpers regression_runner From 52e6e92e9f433659379d7bd76c7f908ae1b0b803 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 2 Jul 2021 12:24:40 +0200 Subject: [PATCH 4/4] Add: [Actions] Check if there were any annotations after testing --- .github/workflows/testing.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 5a6c0c8..b87259a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -74,3 +74,19 @@ jobs: - name: Regression run: | make regression + + check_annotations: + name: Check Annotations + needs: + - flake8 + - black + - regression + # not codeql, as that reports its own status + + if: always() && github.event_name == 'pull_request' + + runs-on: ubuntu-latest + + steps: + - name: Check annotations + uses: OpenTTD/actions/annotation-check@v2