Skip to content

Commit 85a573c

Browse files
committed
Add support for building and syncing specific PRs with Docker and justfile
1 parent 1a30f6d commit 85a573c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,18 @@ WORKDIR /app
4646

4747
RUN git clone --branch main /source /app --local
4848
RUN git remote set-url origin https://github.com/oleander/git-ai.git
49+
RUN git pull origin main
4950
RUN cargo fetch
5051
RUN cargo build
52+
RUN cargo clippy
53+
54+
ARG PR_NUMBER
55+
ARG GH_TOKEN
56+
ENV GH_TOKEN=$GH_TOKEN
57+
RUN gh pr checkout $PR_NUMBER
58+
RUN cargo fetch
59+
RUN cargo build
60+
RUN cargo clippy
5161

5262
# Default command that can be overridden
5363
SHELL ["/bin/bash", "-lc"]

Justfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ integration-test:
2828
docker build -t git-ai-test .
2929
docker run --rm git-ai-test -e OPENAI_API_KEY=$OPENAI_API_KEY
3030

31-
pr CMD:
32-
docker build --target pr-tester -t git-ai-pr-tester .
31+
# just pr 74 "cargo fmt --all"
32+
# just pr 74 "cargo build"
33+
pr PR_NUMBER CMD:
34+
docker build --build-arg PR_NUMBER={{PR_NUMBER}} --build-arg GH_TOKEN=$(gh auth token) --target pr-tester -t git-ai-pr-tester .
3335
docker run -i --rm -e GITHUB_TOKEN=$(gh auth token) git-ai-pr-tester bash -c "{{CMD}}"
36+
37+
# Sync a specific PR with origin/main
38+
sync-pr PR_NUM:
39+
just pr {{PR_NUM}} "git merge origin/main --no-edit && cargo fmt --check && cargo check && git push origin HEAD"

0 commit comments

Comments
 (0)