|
20 | 20 | paths: |
21 | 21 | - 'detectors/*' |
22 | 22 | - '.github/workflows/*' |
23 | | - pull_request_target: |
| 23 | + pull_request: |
24 | 24 | paths: |
25 | 25 | - 'detectors/*' |
26 | 26 | types: [labeled, opened, synchronize, reopened] |
27 | 27 | jobs: |
28 | 28 | # Ensure that tests pass before publishing a new image. |
29 | 29 | build-and-push-ci: |
30 | 30 | # Only run if: |
31 | | - # 1. Tests completed successfully on target branches (from workflow_run trigger), OR |
32 | | - # 2. Direct push/PR trigger (tests will run in parallel) |
| 31 | + # 1. Running in the trustyai-explainability/guardrails-detectors repository, AND |
| 32 | + # 2. Tests completed successfully on target branches (from workflow_run trigger), OR |
| 33 | + # 3. Direct push/PR trigger (tests will run in parallel) |
33 | 34 | if: | |
34 | | - (github.event_name == 'workflow_run' && |
35 | | - github.event.workflow_run.conclusion == 'success' && |
36 | | - contains(fromJSON('["main", "incubation", "stable"]'), github.event.workflow_run.head_branch)) || |
37 | | - (github.event_name != 'workflow_run') |
| 35 | + github.repository == 'trustyai-explainability/guardrails-detectors' && |
| 36 | + ((github.event_name == 'workflow_run' && |
| 37 | + github.event.workflow_run.conclusion == 'success' && |
| 38 | + contains(fromJSON('["main", "incubation", "stable"]'), github.event.workflow_run.head_branch)) || |
| 39 | + (github.event_name != 'workflow_run')) |
38 | 40 | runs-on: ubuntu-latest |
39 | 41 | permissions: |
40 | 42 | contents: read |
@@ -63,12 +65,15 @@ jobs: |
63 | 65 | mode: minimum |
64 | 66 | count: 1 |
65 | 67 | labels: "ok-to-test, lgtm, approved" |
66 | | - - uses: actions/checkout@v3 |
| 68 | + - uses: actions/checkout@v4 |
67 | 69 | if: env.BUILD_CONTEXT == 'ci' |
68 | 70 | with: |
69 | 71 | ref: ${{ github.event.pull_request.head.sha }} |
70 | | - - uses: actions/checkout@v3 |
| 72 | + persist-credentials: false |
| 73 | + - uses: actions/checkout@v4 |
71 | 74 | if: env.BUILD_CONTEXT == 'main' || env.BUILD_CONTEXT == 'tag' |
| 75 | + with: |
| 76 | + persist-credentials: false |
72 | 77 | # |
73 | 78 | # Print variables for debugging |
74 | 79 | - name: Log reference variables |
|
0 commit comments