Skip to content

Commit 9bb1769

Browse files
committed
refactor: remove deploy image workflow and update CI configurations 🛠️
- Delete `.github/workflows/deploy_image.yml` - Update artifact attestation in `ghcr.yml` - Add clippy and rustfmt checks in `rust.yml` - Update environment variable in `compose.yaml` - Expand Docker usage instructions in `README.md` - Modify logging setup in `src/main.rs` - Simplify OpenAI client import in `src/openai.rs`
1 parent 3bf1332 commit 9bb1769

File tree

7 files changed

+23
-61
lines changed

7 files changed

+23
-61
lines changed

.github/workflows/deploy_image.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/ghcr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ jobs:
5151
- name: Generate artifact attestation
5252
uses: actions/attest-build-provenance@v2
5353
with:
54-
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
54+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5555
subject-digest: ${{ steps.push.outputs.digest }}
5656
push-to-registry: true

.github/workflows/rust.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# File Created: 2025-03-05 11:10:40
1010
#
1111
# Modified By: mingcheng ([email protected])
12-
# Last Modified: 2025-03-18 12:22:56
12+
# Last Modified: 2025-03-18 14:54:55
1313
##
1414

1515
name: Cargo Build & Test
@@ -34,6 +34,8 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v4
3636
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
37+
- run: rustup component add clippy --toolchain ${{ matrix.toolchain }}
38+
- run: rustup component add rustfmt --toolchain ${{ matrix.toolchain }}
3739
- run: cargo clippy -- -D warnings
3840
- run: cargo fmt --all -- --check
3941
- run: cargo build --verbose

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ The way to use AIGitComment is really simple. For example, you can run `aigitcom
5959

6060
If you would like more usage settings, just use `aigitcommit --help` to get more details.
6161

62+
### Docker Image
63+
64+
You can also utilise the Docker image without installing the binary executable file.
65+
66+
Simply enter the subsequent command or reference the `compose.yaml` file.
67+
68+
```bash
69+
docker run --rm ghcr.io/mingcheng/aigitcommit:latest \
70+
-v .:\repo:ro \
71+
-e OPENAI_API_BASE='<openai api base>' \
72+
-e OPENAI_API_TOKEN='<token>' \
73+
-e OPENAI_MODEL_NAME='<model name>'
74+
```
75+
76+
Notice: If you wish to utilise the `--commit` option, you must ensure that the `/repo` directory is writable.
77+
6278
### Git Hook
6379

6480
The `AIGitCommit` also supports git hooks. To integrate the hook, simply copy the `hooks/prepare-commit-msg` file into the repository's `.git/hooks/prepare-commit-msg`, and you're done.

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
OPENAI_API_BASE: ""
88
OPENAI_API_TOKEN: ""
99
OPENAI_MODEL_NAME: ""
10-
OPENAI_APT_PROXY: ""
10+
OPENAI_API_PROXY: ""
1111

1212
volumes:
1313
- .:/repo:ro

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use std::error::Error;
2727
use std::fs::File;
2828
use std::io::Write;
2929
use std::{env, fs};
30-
use tracing::{Level, debug, trace};
30+
use tracing::{debug, trace, Level};
3131

3232
#[tokio::main]
3333
async fn main() -> std::result::Result<(), Box<dyn Error>> {

src/openai.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use askama::Template;
1515
use async_openai::config::OPENAI_API_BASE;
1616
use async_openai::error::OpenAIError;
1717
use async_openai::{
18-
Client,
1918
config::OpenAIConfig,
2019
types::{ChatCompletionRequestMessage, CreateChatCompletionRequestArgs},
20+
Client,
2121
};
2222
use log::trace;
2323
use reqwest::header::{HeaderMap, HeaderValue};

0 commit comments

Comments
 (0)