Skip to content

Commit

Permalink
Change: [CI] Update workflows (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
glx22 authored Mar 20, 2024
1 parent 8cd919f commit 894affa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 30 deletions.
35 changes: 7 additions & 28 deletions .github/workflows/commit-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,23 @@ name: Commit checker
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
commit-checker:
name: Commit checker
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 4

- name: Get pull-request commits
run: |
set -x
# 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.
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@v5

- name: Check commits
run: |
set -x
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
release:
name: Release
uses: OpenTTD/actions/.github/workflows/rw-entry-release-baseset.yml@v4
uses: OpenTTD/actions/.github/workflows/rw-entry-release-baseset.yml@v5
secrets: inherit
with:
apt-packages: catcodec
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
testing:
name: Testing
uses: OpenTTD/actions/.github/workflows/rw-entry-testing-baseset.yml@v4
uses: OpenTTD/actions/.github/workflows/rw-entry-testing-baseset.yml@v5
with:
apt-packages: catcodec
name: opensfx

0 comments on commit 894affa

Please sign in to comment.