Skip to content

Commit 8f0b6d5

Browse files
authored
Merge branch 'main' into fix/namespace-trainingruntime-list
Signed-off-by: Moeed <shaikmoeed@gmail.com>
2 parents 1740535 + 57d2052 commit 8f0b6d5

47 files changed

Lines changed: 5526 additions & 333 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check-pr-title.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
ci
3434
docs
3535
examples
36+
optimizer
3637
scripts
3738
test
3839
trainer
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Approve Workflow Runs
2+
3+
permissions:
4+
actions: write
5+
contents: read
6+
7+
on:
8+
pull_request_target:
9+
types:
10+
- labeled
11+
- synchronize
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
ok-to-test:
19+
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') || github.event_name == 'pull_request_target'
20+
runs-on: ubuntu-latest
21+
continue-on-error: true
22+
23+
steps:
24+
- name: Check if author is a Kubeflow GitHub member
25+
id: membership-check
26+
uses: actions/github-script@v7
27+
with:
28+
script: |
29+
const username = context.payload.pull_request.user.login;
30+
const org = context.repo.owner;
31+
try {
32+
const res = await github.rest.orgs.checkMembershipForUser({
33+
org,
34+
username
35+
});
36+
core.setOutput("is_member", true);
37+
} catch (error) {
38+
if (error.status === 404) {
39+
core.setOutput("is_member", false);
40+
} else {
41+
throw error;
42+
}
43+
}
44+
45+
- name: Approve Pending Workflow Runs
46+
if: steps.membership-check.outputs.is_member == 'true' || contains(github.event.pull_request.labels.*.name, 'ok-to-test')
47+
uses: actions/github-script@v7
48+
with:
49+
retries: 3
50+
script: |
51+
const request = {
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
event: "pull_request",
55+
status: "action_required",
56+
head_sha: context.payload.pull_request.head.sha,
57+
}
58+
59+
core.info(`Getting workflow runs that need approval for commit ${request.head_sha}`)
60+
const runs = await github.paginate(github.rest.actions.listWorkflowRunsForRepo, request)
61+
62+
core.info(`Found ${runs.length} workflow runs that need approval`)
63+
for (const run of runs) {
64+
core.info(`Approving workflow run ${run.id}`)
65+
const approveReq = {
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
run_id: run.id,
69+
}
70+
await github.rest.actions.approveWorkflowRun(approveReq)
71+
}

.github/workflows/test-python.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
- uses: pre-commit/action@v3.0.1
19+
1320
test:
1421
runs-on: ubuntu-latest
22+
needs: pre-commit
1523
strategy:
1624
fail-fast: false
1725
matrix:

0 commit comments

Comments
 (0)