forked from NVIDIA/Model-Optimizer
-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (62 loc) · 2.12 KB
/
Copy path_pr_gate.yml
File metadata and controls
64 lines (62 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: PR Gate
on:
workflow_call:
inputs:
files:
description: "Newline-separated list of file patterns to watch for changes"
required: true
type: string
files_ignore:
description: "Newline-separated patterns to ignore; defaults to docs-only files no test runs"
required: false
type: string
default: |
**/*.ipynb
**/*.md
**/*.png
**/*.rst
outputs:
any_changed:
description: "Whether any relevant files changed"
value: ${{ jobs.check-file-changes.outputs.any_changed }}
jobs:
check-file-changes:
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-tests.outputs.any_modified || steps.non-pr.outputs.any_changed }}
steps:
# For non-PR triggers (schedule, workflow_dispatch), always run tests
- id: non-pr
if: "!startsWith(github.ref, 'refs/heads/pull-request/')"
run: echo "any_changed=true" >> $GITHUB_OUTPUT
- if: startsWith(github.ref, 'refs/heads/pull-request/')
uses: actions/checkout@v6
with:
fetch-depth: 0
- if: startsWith(github.ref, 'refs/heads/pull-request/')
id: base
uses: ./.github/actions/pr-merge-base
- if: startsWith(github.ref, 'refs/heads/pull-request/')
name: Check for changes in test-relevant directories
id: changed-tests
uses: step-security/changed-files@v47.0.5
with:
base_sha: ${{ steps.base.outputs.merge_base }}
sha: ${{ steps.base.outputs.head_sha }}
files: ${{ inputs.files }}
files_ignore: ${{ inputs.files_ignore }}
fail_on_initial_diff_error: true
wait-checks:
needs: [check-file-changes]
if: >-
startsWith(github.ref, 'refs/heads/pull-request/') &&
needs.check-file-changes.outputs.any_changed == 'true'
runs-on: ubuntu-latest
permissions:
checks: read
steps:
- uses: poseidon/wait-for-status-checks@v0.7.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
match_pattern: "^linux$" # Wait for Unit tests / linux
delay: 300s