Repository navigation
131 lines (123 loc) · 4.58 KB
/
Copy pathredmine-upkeep.yml
File metadata and controls
131 lines (123 loc) · 4.58 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
name: Redmine Upkeep
on:
# To manually trigger this: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
# View past runs and output: https://github.com/ceph/ceph/actions/workflows/create-backport-trackers.yml
workflow_dispatch:
inputs:
issue:
description: 'issue to update'
type: string
default: ''
filter:
description: '--filter: limit to specific filter (e.g. "Pending Backport")'
type: string
default: ''
limit:
description: '--limit: limit issue traversal'
default: 50
type: int
debug:
description: '--debug: Show debug-level messages'
default: false
type: boolean
schedule:
- cron: '*/5 * * * *'
- cron: '0 */12 * * *'
pull_request_target:
types: [closed]
branches:
- main
- squid
- tentacle
- umbrella
- vampire
# TODO enable/setup after upkeep has caught up
# push:
# tags:
# - 'v*'
# for testing
push:
branches:
- 'feature/redmine-upkeep'
jobs:
redmine-upkeep:
runs-on: ubuntu-latest
if: github.repository == 'ceph/ceph'
steps:
- name: Checkout main branch for pull_request_target
if: github.event_name == 'pull_request_target'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: 'refs/heads/main'
path: 'ceph'
fetch-depth: 0
- name: Checkout default branch for other events
if: github.event_name != 'pull_request_target'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: 'ceph'
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.14'
cache: 'pip'
cache-dependency-path: ceph/src/script/requirements.redmine-upkeep.txt
- name: Install dependencies
run: pip install -r ceph/src/script/requirements.redmine-upkeep.txt
- name: Run redmine-upkeep via workflow_dispatch
if: github.event_name == 'workflow_dispatch'
run: >
python3 ceph/src/script/redmine-upkeep.py
--github-action
--git-dir=./ceph/
${{ inputs.issue != '' && format('--issue={0}', inputs.issue) || '' }}
${{ inputs.debug && '--debug' || '' }}
${{ inputs.filter != '' && format('--filter="{0}"', inputs.filter) || '' }}
${{ format('--limit={0}', inputs.limit) }}
env:
REDMINE_API_KEY: ${{ secrets.REDMINE_API_KEY_BACKPORT_BOT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run fast redmine-upkeep via schedule
if: github.event_name == 'schedule' && github.event.schedule == '*/5 * * * *'
run: >
python3 ceph/src/script/redmine-upkeep.py
--github-action
--git-dir=./ceph/
--filter="Pending Backport"
--limit=50
env:
REDMINE_API_KEY: ${{ secrets.REDMINE_API_KEY_BACKPORT_BOT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run full redmine-upkeep via schedule
if: github.event_name == 'schedule' && github.event.schedule == '0 */12 * * *'
run: >
python3 ceph/src/script/redmine-upkeep.py
--github-action
--git-dir=./ceph/
--limit=5000
env:
REDMINE_API_KEY: ${{ secrets.REDMINE_API_KEY_BACKPORT_BOT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run redmine-upkeep via test push
if: github.event_name == 'push' && github.ref == 'refs/heads/feature/redmine-upkeep'
run: >
python3 ceph/src/script/redmine-upkeep.py
--github-action
--git-dir=./ceph/
--limit=50
env:
REDMINE_API_KEY: ${{ secrets.REDMINE_API_KEY_BACKPORT_BOT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run redmine-upkeep via merge on pull_request_target
if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true
run: >
python3 ceph/src/script/redmine-upkeep.py
--github-action
--git-dir=./ceph/
--pull-request=${{ github.event.pull_request.number }}
--merge-commit=${{ github.event.pull_request.merge_commit_sha }}
env:
REDMINE_API_KEY: ${{ secrets.REDMINE_API_KEY_BACKPORT_BOT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}