Skip to content

Commit 89bbf0f

Browse files
shahbazk8194pixar-oss
authored andcommitted
USD github workflows updates:
- Trigger workflows on pull requests - Add Validation job to filter PR files to prevent triggering workflows for files that span the workflows directory - Remove GetGitRef job and use github.ref instead - Remove GetUser job - Remove /AzurePipelines run comment trigger (Internal change: 2367224)
1 parent d0d897e commit 89bbf0f

File tree

1 file changed

+27
-43
lines changed

1 file changed

+27
-43
lines changed

.github/workflows/buildusd.yml

Lines changed: 27 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,35 @@ on:
55
branches:
66
- dev
77
- release
8-
issue_comment:
9-
types: [created]
8+
pull_request:
9+
branches:
10+
- dev
11+
paths:
12+
- '**'
13+
- '!.github/workflows/**'
1014

1115
jobs:
12-
GetUser:
16+
Validation:
1317
runs-on: ubuntu-22.04
14-
timeout-minutes: 5
18+
timeout-minutes: 30
1519
outputs:
16-
require-result: ${{ steps.check.outputs.require-result }}
20+
validation-failed: ${{ steps.changed-workflows.outputs.any_changed }}
1721
steps:
18-
- uses: actions-cool/check-user-permission@v2
19-
id: check
22+
- name: Checkout code
23+
uses: actions/checkout@v4
2024
with:
21-
require: 'write'
22-
username: ${{ github.event.comment.user.login }}
23-
24-
GetGitRef:
25-
runs-on: ubuntu-22.04
26-
timeout-minutes: 5
27-
outputs:
28-
ref: ${{ steps.setter.outputs.ref }}
29-
steps:
30-
- name: Get push ref
31-
if: ${{ github.event_name == 'push' }}
32-
run: |
33-
echo "REF=${{ github.ref }}" >> $GITHUB_ENV
34-
- name: Get PR ref
35-
if: ${{ github.event.issue.pull_request }}
36-
run: |
37-
echo "REF=refs/pull/${{ github.event.issue.number }}/merge" >> $GITHUB_ENV
38-
- name: Print ENV_VAR
39-
run: |
40-
echo "The value of REF is $REF"
41-
- name: Set ENV_VAR
42-
id: setter
43-
run: |
44-
echo "ref=$REF" >> "$GITHUB_OUTPUT"
25+
ref: ${{ github.ref }}
26+
- name: Check workflows directory
27+
id: changed-workflows
28+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c #v46
29+
with:
30+
files: |
31+
.github/workflows/**
4532
4633
Linux:
4734
needs:
48-
- GetUser
49-
- GetGitRef
50-
if: ${{ (github.event.issue.pull_request && contains(github.event.comment.body, '/AzurePipelines run') && needs.GetUser.outputs.require-result == 'true' ) || github.event_name == 'push' }}
35+
- Validation
36+
if: ${{ (github.event_name == 'pull_request' && needs.Validation.outputs.validation-failed != 'true') || github.event_name == 'push' }}
5137
runs-on: ubuntu-22.04
5238
env:
5339
PYTHON_VERSION: "3.9"
@@ -56,7 +42,7 @@ jobs:
5642
- name: Checkout code
5743
uses: actions/checkout@v4
5844
with:
59-
ref: ${{needs.GetGitRef.outputs.ref}}
45+
ref: ${{ github.ref }}
6046
- name: Restore cached artifacts
6147
id: cache-usd-build-dependency
6248
uses: actions/cache/restore@v4
@@ -98,9 +84,8 @@ jobs:
9884
9985
macOS:
10086
needs:
101-
- GetUser
102-
- GetGitRef
103-
if: ${{ (github.event.issue.pull_request && contains(github.event.comment.body, '/AzurePipelines run') && needs.GetUser.outputs.require-result == 'true' ) || github.event_name == 'push' }}
87+
- Validation
88+
if: ${{ (github.event_name == 'pull_request' && needs.Validation.outputs.validation-failed != 'true') || github.event_name == 'push' }}
10489
runs-on: macos-13
10590
env:
10691
PYTHON_VERSION: "3.11"
@@ -109,7 +94,7 @@ jobs:
10994
- name: Checkout code
11095
uses: actions/checkout@v4
11196
with:
112-
ref: ${{needs.GetGitRef.outputs.ref}}
97+
ref: ${{ github.ref }}
11398
- name: Restore cached artifacts
11499
id: cache-usd-build-dependency
115100
uses: actions/cache/restore@v4
@@ -156,9 +141,8 @@ jobs:
156141
157142
Windows:
158143
needs:
159-
- GetUser
160-
- GetGitRef
161-
if: ${{ (github.event.issue.pull_request && contains(github.event.comment.body, '/AzurePipelines run') && needs.GetUser.outputs.require-result == 'true' ) || github.event_name == 'push' }}
144+
- Validation
145+
if: ${{ (github.event_name == 'pull_request' && needs.Validation.outputs.validation-failed != 'true') || github.event_name == 'push' }}
162146
runs-on: windows-2019
163147
env:
164148
PYTHON_VERSION: "3.9"
@@ -167,7 +151,7 @@ jobs:
167151
- name: Checkout code
168152
uses: actions/checkout@v4
169153
with:
170-
ref: ${{needs.GetGitRef.outputs.ref}}
154+
ref: ${{ github.ref }}
171155
- name: Restore cached artifacts
172156
id: cache-usd-build-dependency
173157
uses: actions/cache/restore@v4

0 commit comments

Comments
 (0)