-
Notifications
You must be signed in to change notification settings - Fork 9
88 lines (83 loc) · 2.91 KB
/
prune.yml
File metadata and controls
88 lines (83 loc) · 2.91 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This workflow is used to prune runners by creating a pull request.
# It can be triggered manually via the GitHub Actions UI.
name: prune
permissions:
actions: write
contents: write
pull-requests: write
defaults:
run:
shell: bash
on:
workflow_dispatch:
inputs:
# Control how to choice the backend to prune.
backend:
description: 'Backend, which accelerated backend to prune'
required: true
type: choice
options:
- cann
- corex
- cuda
- dtk
- hggc
- maca
- musa
- rocm
backend_version:
description: 'Backend version, which version of the backend to prune'
required: false
type: string
backend_variant:
description: 'Backend variant, which variant of the backend to prune'
required: false
type: string
# Control how to choice the service to prune.
service:
description: 'Service, which service to prune'
required: false
type: string
service_version:
description: 'Service version, which version of the service to prune'
required: false
type: string
jobs:
# Submit a PR to prune the runner.
prune-runner:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 1
persist-credentials: false
- name: Prune Runner
env:
INPUT_BACKEND: ${{ github.event.inputs.backend }}
INPUT_BACKEND_VERSION: ${{ github.event.inputs.backend_version }}
INPUT_BACKEND_VARIANT: ${{ github.event.inputs.backend_variant }}
INPUT_SERVICE: ${{ github.event.inputs.service }}
INPUT_SERVICE_VERSION: ${{ github.event.inputs.service_version }}
INPUT_WORKSPACE: ${{ github.workspace }}/pack
INPUT_TEMPDIR: ${{ runner.temp }}
run: ${{ github.workspace }}/pack/prune_runner.sh
- name: Generate Pull Request Token
id: generate-prt
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.CI_PRT_GENERATOR_ID }}
private-key: ${{ secrets.CI_PRT_GENERATOR_KEY }}
- name: Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-prt.outputs.token }}
branch: "create-pull-request/prune-runner-${{ github.run_id }}"
delete-branch: true
commit-message: "chore: prune runner by gha workflow ${{ github.run_id }}"
title: "chore: prune runner by gha workflow ${{ github.run_id }}"
reviewers: ${{ github.actor }}
assignees: ${{ github.actor }}
body: |
Prune runner by GHA workflow [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).