From e8e8c4a7eec6c0f5229e6483f424bc9aa087ae61 Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Mon, 4 Mar 2024 23:36:47 -0500 Subject: [PATCH 1/5] updating test action --- .github/workflows/test.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 546b8d20..fad27a1e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,7 @@ name: Test on: + pull_request_target: + branches: [ master ] push: branches: - main @@ -8,7 +10,7 @@ on: - main jobs: test-main: - if: github.ref == 'refs/heads/main' + if: github.repository == 'instructor-ai/instructor-js' && github.ref == 'refs/heads/main' name: run-tests runs-on: ubuntu-latest environment: TEST-MAIN @@ -39,10 +41,19 @@ jobs: - run: bun run lint - run: bun test --timeout=25000 + approve: + if: github.event_name == 'pull_request_target' + runs-on: ubuntu-latest + + steps: + - name: Approve + run: echo For security reasons, all pull requests need to be approved first before running any automated CI. + test-branch: - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request_target' name: run-tests runs-on: ubuntu-latest + needs: [approve] environment: OPENAI env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} @@ -52,7 +63,8 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 2 - name: Setup bun uses: oven-sh/setup-bun@v1 From 016e3c55db51efa41c39f4f1389a5da424881827 Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Mon, 4 Mar 2024 23:39:11 -0500 Subject: [PATCH 2/5] update --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fad27a1e..f4da4040 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,12 +5,9 @@ on: push: branches: - main - pull_request: - branches: - - main jobs: test-main: - if: github.repository == 'instructor-ai/instructor-js' && github.ref == 'refs/heads/main' + if: github.repository == 'instructor-ai/instructor-js' && github.ref == 'refs/heads/main' && github.event_name == 'push' name: run-tests runs-on: ubuntu-latest environment: TEST-MAIN From f120f149f6808fbc7814515513497c8ca951d055 Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Mon, 4 Mar 2024 23:46:51 -0500 Subject: [PATCH 3/5] whitespace --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bc7f6cc3..00345b51 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,4 @@ This project is licensed under the terms of the MIT License. - [ ] Action Item and Dependency Mapping These translations provide a structured approach to creating TypeScript schemas with Zod, mirroring the functionality and intent of the original Python examples. + From 318c4fa6170813ec69fc1f00b5526a1b3b7261a0 Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Mon, 4 Mar 2024 23:48:41 -0500 Subject: [PATCH 4/5] update event name --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4da4040..580501d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: - run: bun test --timeout=25000 approve: - if: github.event_name == 'pull_request_target' + if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: @@ -47,7 +47,7 @@ jobs: run: echo For security reasons, all pull requests need to be approved first before running any automated CI. test-branch: - if: github.event_name == 'pull_request_target' + if: github.event_name == 'pull_request' name: run-tests runs-on: ubuntu-latest needs: [approve] From 53c2ec574af8886288d841b744bf5f967920720a Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Mon, 4 Mar 2024 23:51:29 -0500 Subject: [PATCH 5/5] dont check event name --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 580501d5..56e0c2b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: - main jobs: test-main: - if: github.repository == 'instructor-ai/instructor-js' && github.ref == 'refs/heads/main' && github.event_name == 'push' + if: github.repository == 'instructor-ai/instructor-js' && github.ref == 'refs/heads/main' name: run-tests runs-on: ubuntu-latest environment: TEST-MAIN @@ -39,7 +39,7 @@ jobs: - run: bun test --timeout=25000 approve: - if: github.event_name == 'pull_request' + if: github.ref != 'refs/heads/main' runs-on: ubuntu-latest steps: @@ -47,7 +47,7 @@ jobs: run: echo For security reasons, all pull requests need to be approved first before running any automated CI. test-branch: - if: github.event_name == 'pull_request' + if: github.ref != 'refs/heads/main' name: run-tests runs-on: ubuntu-latest needs: [approve]