mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
Change: [Actions] use newly created Actions instead of custom shell-scripting (#9284)
This commit is contained in:
parent
ca9f9b84d3
commit
3477405e86
30
.github/workflows/ci-build.yml
vendored
30
.github/workflows/ci-build.yml
vendored
@ -326,34 +326,8 @@ jobs:
|
|||||||
|
|
||||||
if: always() && github.event_name == 'pull_request'
|
if: always() && github.event_name == 'pull_request'
|
||||||
|
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Get check suite ID
|
|
||||||
id: check_suite_id
|
|
||||||
uses: octokit/request-action@v2.x
|
|
||||||
with:
|
|
||||||
route: GET /repos/{repository}/actions/runs/{run_id}
|
|
||||||
repository: ${{ github.repository }}
|
|
||||||
run_id: ${{ github.run_id }}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Get check runs
|
|
||||||
id: check_runs
|
|
||||||
uses: octokit/request-action@v2.x
|
|
||||||
with:
|
|
||||||
route: GET /repos/{repository}/check-suites/{check_suite_id}/check-runs
|
|
||||||
repository: ${{ github.repository }}
|
|
||||||
check_suite_id: ${{ fromJson(steps.check_suite_id.outputs.data).check_suite_id }}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Check annotations
|
- name: Check annotations
|
||||||
shell: bash
|
uses: OpenTTD/actions/annotation-check@v2
|
||||||
run: |
|
|
||||||
echo '[
|
|
||||||
${{ toJson(fromJson(steps.check_runs.outputs.data).check_runs.*.output.title) }}, ${{ toJson(fromJson(steps.check_runs.outputs.data).check_runs.*.output.summary) }}
|
|
||||||
]' | jq '.[0] as $t | .[1] as $s | reduce range(.[0] | length) as $i ([]; . + [if $t[$i] then $t[$i] + ": " + $s[$i] else empty end]) | .[]'
|
|
||||||
|
|
||||||
exit $(echo '${{ toJson(fromJson(steps.check_runs.outputs.data).check_runs.*.output.annotations_count) }}' | jq 'add')
|
|
||||||
|
34
.github/workflows/commit-checker.yml
vendored
34
.github/workflows/commit-checker.yml
vendored
@ -15,37 +15,7 @@ jobs:
|
|||||||
fetch-depth: 4
|
fetch-depth: 4
|
||||||
|
|
||||||
- name: Get pull-request commits
|
- name: Get pull-request commits
|
||||||
run: |
|
uses: OpenTTD/actions/checkout-pull-request@v2
|
||||||
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
|
|
||||||
# Prevent infinite recursion
|
|
||||||
if [ ${DEPTH} -gt 256 ]; then
|
|
||||||
echo "No common parent between '${GITHUB_HEAD_REF}' and '${GITHUB_BASE_REF}'." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
- name: Check commits
|
- name: Check commits
|
||||||
run: |
|
uses: OpenTTD/OpenTTD-git-hooks@main
|
||||||
set -x
|
|
||||||
HOOKS_DIR=./git-hooks/hooks GIT_DIR=.git ./git-hooks/hooks/check-commits.sh HEAD^..HEAD^2
|
|
||||||
echo "Commit checks passed"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user