Skip to content
This repository was archived by the owner on May 28, 2022. It is now read-only.

Commit 1528390

Browse files
committed
Start to use act to run GitHub actions locally
For example: act -j check_rebase # fails on a merge commit act -j check_history # fails unless on a merge commit, typically from bors `act` uses the job ID rather than the job name; `bors` uses the job name. `act` 0.2.0 doesn't support the `container: name:tag` syntax. Start to support https://github.com/nektos/act for local testing. `act` has partial support for GitHub actions. This change works around two issues: 1. Steps in GitHub actions can be run on the virtual machine host directly or inside a container. The virtual machines are configure with a [long list] of available software, including `git`. At present `act` does not make that software available locally, so instead we run inside a container. The `act` maintainer describes this as a [known issue]. 2. The checkout on GitHub leaves a shallow repository. The checkout step on `act` leaves a complete repository. Running `git fetch --unshallow` on a complete repository fails with the error below. As a workaround add `|| true` so it succeeds in both. fatal: --unshallow on a complete repository does not make sense [long list]: https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md [known issue]: nektos/act#74 (comment)
1 parent 1d64f74 commit 1528390

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.github/workflows/check-commits.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
on: { pull_request }
22

33
jobs:
4-
check:
4+
check_history:
55
runs-on: ubuntu-latest
6+
container: { image: "quay.io/keith_maxwell/lumosql-build:fedora" }
67
name: Check commits
78
steps:
89
- uses: actions/checkout@v2
910
- name: Fetch all history so that later commands succeed
10-
run: git fetch --prune --unshallow
11+
run: git fetch --prune --unshallow || true
1112
- name: Fail if any commits have a subject line starting fixup!
1213
run:
1314
"! git log --pretty=format:%s%n origin/master..HEAD | grep -q ^fixup!"

.github/workflows/semi-linear.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
on: { push: { branches: [staging, trying] } }
22

33
jobs:
4-
check:
4+
check_rebase:
55
runs-on: ubuntu-latest
6+
container: { image: "quay.io/keith_maxwell/lumosql-build:fedora" }
67
name: Semi linear
78
steps:
89
- uses: actions/checkout@v2
910
- name: Fetch all history so that later commands succeed
10-
run: git fetch --prune --unshallow
11+
run: git fetch --prune --unshallow || true
1112
- name: Fail if the branch requires a rebase
1213
run:
1314
test "$(git rev-parse origin/master)" = "$(git merge-base

0 commit comments

Comments
 (0)