-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updating test action #131
updating test action #131
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
name: Test | ||
on: | ||
pull_request_target: | ||
branches: [ master ] | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- 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 +38,19 @@ jobs: | |
- run: bun run lint | ||
- run: bun test --timeout=25000 | ||
|
||
approve: | ||
if: github.ref != 'refs/heads/main' | ||
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 'test-branch' job now runs on 'pull_request_target' and depends on the 'approve' job. As mentioned earlier, 'pull_request_target' could lead to testing stale code. Also, the dependency on 'approve' job might not add any value as the 'approve' job does not perform any approval action. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the approve job just logs out - but the repo settings require an approval from an admin to run |
||
if: github.event_name == 'pull_request' | ||
if: github.ref != 'refs/heads/main' | ||
name: run-tests | ||
runs-on: ubuntu-latest | ||
needs: [approve] | ||
environment: OPENAI | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
|
@@ -52,7 +60,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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description mentions that the
approve
andtest-branch
jobs have been changed to trigger onpull_request
instead ofpull_request_target
, but I don't see this change reflected in the diff. The condition for these jobs isgithub.ref != 'refs/heads/main'
, which means they will run for any branch that is notmain
, regardless of whether it's a pull request or not. Please confirm if this is an oversight.