Skip to content

feat: add fast-forward_or_merge merge method #78

feat: add fast-forward_or_merge merge method

feat: add fast-forward_or_merge merge method #78

Workflow file for this run

name: Build
on: [push, pull_request]
permissions:
contents: read
jobs:
test:
name: Rust test & lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --locked -- -D warnings
- name: Run tests
run: cargo test --locked --all-targets
docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v4
- name: Build action image
run: make docker-build
env:
PLATFORM: linux/amd64
ACTION: load
PROGRESS_MODE: plain
IMAGE_TAG: action-pull-request-merge:ci
# ---- Smoke tests on the freshly-built image ------------------
# The image is FROM scratch (no shell), so we invoke the binary
# via `docker run` and only check exit code + stdout. No network
# calls are needed: the actor-mismatch path short-circuits
# before any API request.
#
# Each test captures exit code AND output, prints both to the
# CI log, then asserts. If anything is off the log shows
# exactly what the binary produced.
- name: Smoke test — image inspection
run: docker image inspect action-pull-request-merge:ci --format '{{.Os}}/{{.Architecture}} entrypoint={{.Config.Entrypoint}}'
- name: Smoke test — missing input fails with exit 1
run: |
set +e
docker run --rm action-pull-request-merge:ci >/tmp/out 2>&1
code=$?
set -e
echo "=== exit: $code ==="
echo "=== output: ==="
cat /tmp/out
echo "=== end ==="
test "$code" -ne 0
grep -q "Input required and not supplied: github-token" /tmp/out
- name: Smoke test — actor mismatch skips cleanly with exit 0
run: |
set +e
docker run --rm \
-e "INPUT_GITHUB-TOKEN=dummy" \
-e "INPUT_NUMBER=1" \
-e "INPUT_ALLOWED-USERNAMES-REGEX=^nobody$" \
-e "GITHUB_REPOSITORY=octo/widget" \
-e "GITHUB_ACTOR=alice" \
action-pull-request-merge:ci >/tmp/out 2>&1
code=$?
set -e
echo "=== exit: $code ==="
echo "=== output: ==="
cat /tmp/out
echo "=== end ==="
test "$code" -eq 0
grep -q "Ignored, the username does not match" /tmp/out