feat: implement runtime snapshot mechanism (KEP-2599) #5867
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright The Kubeflow Authors. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: Approve Workflow Runs | |
| permissions: | |
| actions: write | |
| contents: read | |
| on: | |
| pull_request_target: | |
| types: | |
| - labeled | |
| - synchronize | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| ok-to-test: | |
| if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') || github.event_name == 'pull_request_target' | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - name: Check if author is a Kubeflow GitHub member | |
| id: membership-check | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | |
| with: | |
| script: | | |
| const username = context.payload.pull_request.user.login; | |
| const org = context.repo.owner; | |
| try { | |
| const res = await github.rest.orgs.checkMembershipForUser({ | |
| org, | |
| username | |
| }); | |
| core.setOutput("is_member", true); | |
| } catch (error) { | |
| if (error.status === 404) { | |
| // User is not a member | |
| core.setOutput("is_member", false); | |
| } else { | |
| throw error; | |
| } | |
| } | |
| - name: Approve Pending Workflow Runs | |
| if: steps.membership-check.outputs.is_member == 'true' || contains(github.event.pull_request.labels.*.name, 'ok-to-test') | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | |
| with: | |
| retries: 3 | |
| script: | | |
| const request = { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| event: "pull_request", | |
| status: "action_required", | |
| head_sha: context.payload.pull_request.head.sha, | |
| } | |
| core.info(`Getting workflow runs that need approval for commit ${request.head_sha}`) | |
| const runs = await github.paginate(github.rest.actions.listWorkflowRunsForRepo, request) | |
| core.info(`Found ${runs.length} workflow runs that need approval`) | |
| for (const run of runs) { | |
| core.info(`Approving workflow run ${run.id}`) | |
| const request = { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| run_id: run.id, | |
| } | |
| await github.rest.actions.approveWorkflowRun(request) | |
| } |