From 5830c3d177dbe09cfaa59b1ba7bbde3bad4e3486 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 15 Dec 2025 11:46:31 +0800 Subject: [PATCH 1/2] Add Redis and Apple Private Key Setup to CI Workflows - Added the `OPENAI_API_KEY` environment variable to both `pr-test.yml` and `unit-test.yml` workflows for improved API access. - Introduced a step to set up the Apple Private Key in both workflows, enhancing security for Apple-related operations. - Integrated Redis service setup in both workflows to support caching and improve test performance. --- .github/workflows/pr-test.yml | 16 ++++++++++++++++ .github/workflows/unit-test.yml | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index ea148165..1c541061 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -40,6 +40,7 @@ env: OPENAI_TEST_KEY: ${{ secrets.OPENAI_TEST_KEY }} TEST_MOAPI_SECRET: ${{ secrets.OPENAI_TEST_KEY }} + OPENAI_API_KEY: ${{ secrets.OPENAI_TEST_KEY }} TEST_MOAPI_MIRROR: https://api.openai.com # DeepSeek API Configuration @@ -314,11 +315,21 @@ jobs: with: ref: ${{ env.HEAD }} + - name: Setup Apple Private Key + run: | + mkdir -p ../app/openapi/certs/apple + echo "${{ secrets.APPLE_PRIVATE_KEY_USER }}" > ../app/openapi/certs/apple/signin_client_secret_key.p8 + - name: Setup Go ${{ matrix.go }} uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} + - name: Start Redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + - name: Setup Go Tools run: make tools @@ -468,6 +479,11 @@ jobs: with: go-version: ${{ matrix.go }} + - name: Start Redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + - name: Setup Go Tools run: make tools diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c936b7a1..c3bf659d 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -44,6 +44,7 @@ env: OPENAI_TEST_KEY: ${{ secrets.OPENAI_TEST_KEY }} TEST_MOAPI_SECRET: ${{ secrets.OPENAI_TEST_KEY }} + OPENAI_API_KEY: ${{ secrets.OPENAI_TEST_KEY }} TEST_MOAPI_MIRROR: https://api.openai.com # DeepSeek API Configuration @@ -273,11 +274,21 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 + - name: Setup Apple Private Key + run: | + mkdir -p ../app/openapi/certs/apple + echo "${{ secrets.APPLE_PRIVATE_KEY_USER }}" > ../app/openapi/certs/apple/signin_client_secret_key.p8 + - name: Setup Go ${{ matrix.go }} uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} + - name: Start Redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + - name: Setup Go Tools run: make tools @@ -379,6 +390,11 @@ jobs: with: go-version: ${{ matrix.go }} + - name: Start Redis + uses: supercharge/redis-github-action@1.4.0 + with: + redis-version: 6 + - name: Setup Go Tools run: make tools From 2a191950d7dc6d01d98d4a7da1b1c3abd27e8ea6 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 15 Dec 2025 12:10:01 +0800 Subject: [PATCH 2/2] Refactor AIGC ID Handling in Load Function - Renamed the ID generation function to `aigcID` for clarity and added a new function to parse AIGC IDs from file paths. - Implemented special handling for `.ai.yml` and `.ai.yaml` extensions to correctly format the AIGC ID by removing the "_ai" suffix, improving ID accuracy in the loading process. --- aigc/load.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/aigc/load.go b/aigc/load.go index a7995689..c3c99857 100644 --- a/aigc/load.go +++ b/aigc/load.go @@ -28,7 +28,7 @@ func Load(cfg config.Config) error { return nil } - id := share.ID(root, file) + id := aigcID(root, file) _, err := LoadFile(file, id) if err != nil { messages = append(messages, err.Error()) @@ -48,6 +48,17 @@ func Load(cfg config.Config) error { return nil } +// aigcID parses AIGC ID from file path +// Special handling for .ai.yml and .ai.yaml extensions +// e.g., "aigcs/translate.ai.yml" -> "translate" +func aigcID(root, file string) string { + id := share.ID(root, file) + // Remove "_ai" suffix caused by .ai.yml/.ai.yaml extension + // share.ID treats .yml/.yaml as single extension, so "translate.ai.yml" becomes "translate_ai" + id = strings.TrimSuffix(id, "_ai") + return id +} + // LoadFile load AIGC by file func LoadFile(file string, id string) (*DSL, error) {