Repository navigation
176 lines (170 loc) · 5.77 KB
/
Copy pathclean.yml
File metadata and controls
176 lines (170 loc) · 5.77 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Update jdkdb - clean
on:
workflow_dispatch:
inputs:
remove-incomplete:
description: 'Remove incomplete data (checksums, release_info, or all)'
required: false
type: choice
options:
- ''
- checksums
- release_info
- all
default: ''
prune-invalid:
description: 'Prune invalid data'
required: true
type: boolean
default: true
remove-orphaned:
description: 'Remove orphaned data'
required: true
type: boolean
default: true
prune-ea:
description: 'Prune EA releases older than this age'
required: false
type: string
default: '100y'
prune-unlisted:
description: 'Prune unlisted releases older than this age'
required: false
type: string
default: ''
prune-missing:
description: 'Prune metadata missing from the source older than this age'
required: false
type: string
default: ''
prune-unlisted-missing:
description: 'Prune metadata both unlisted and missing older than this age'
required: false
type: string
default: '1w'
do_commit:
description: 'Commit the changes after cleaning data'
required: true
type: boolean
default: true
workflow_call:
inputs:
remove-incomplete:
description: 'Remove incomplete data (checksums, release_info, or all)'
required: false
type: string
default: ''
prune-invalid:
description: 'Prune invalid data'
required: false
type: boolean
default: true
remove-orphaned:
description: 'Remove orphaned data'
required: false
type: boolean
default: true
prune-ea:
description: 'Prune EA releases older than this age'
required: false
type: string
default: '100y'
prune-unlisted:
description: 'Prune unlisted releases older than this age'
required: false
type: string
default: ''
prune-missing:
description: 'Prune metadata missing from the source older than this age'
required: false
type: string
default: ''
prune-unlisted-missing:
description: 'Prune metadata both unlisted and missing older than this age'
required: false
type: string
default: '1w'
do_commit:
description: 'Commit the changes after cleaning data'
required: false
type: boolean
default: true
branch:
description: 'Branch to commit to (leave empty to use current branch)'
required: false
type: string
default: ''
outputs:
changes_detected:
description: 'Whether the commit step detected and committed any changes'
value: ${{ jobs.process.outputs.changes_detected }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
process:
runs-on: 'ubuntu-latest'
outputs:
changes_detected: ${{ steps.commit.outputs.changes_detected }}
env:
APP: https://github.com/jbangdev/jdkdb-scraper/releases/latest/download/jdkdb-scraper-standalone.jar
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ inputs.branch || github.ref }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y binutils cpio rpm2cpio msitools
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: '21'
distribution: 'temurin'
- name: Setup JBang
uses: jbangdev/setup-jbang@312c53a4221283f9c8e4aa84d8261b82f0c680fb # main
- name: Run cleaner
continue-on-error: true
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
EXTRA_OPTS=""
if [ -n "${{ inputs.remove-incomplete }}" ]; then
EXTRA_OPTS="$EXTRA_OPTS --remove-incomplete ${{ inputs.remove-incomplete }}"
fi
if [ "${{ inputs.prune-invalid }}" = "true" ]; then
EXTRA_OPTS="$EXTRA_OPTS --prune-invalid"
fi
if [ "${{ inputs.remove-orphaned }}" = "true" ]; then
EXTRA_OPTS="$EXTRA_OPTS --remove-orphaned"
fi
if [ -n "${{ inputs.prune-ea }}" ]; then
EXTRA_OPTS="$EXTRA_OPTS --prune-ea ${{ inputs.prune-ea }}"
fi
if [ -n "${{ inputs.prune-unlisted }}" ]; then
EXTRA_OPTS="$EXTRA_OPTS --prune-unlisted ${{ inputs.prune-unlisted }}"
fi
if [ -n "${{ inputs.prune-missing }}" ]; then
EXTRA_OPTS="$EXTRA_OPTS --prune-missing ${{ inputs.prune-missing }}"
fi
if [ -n "${{ inputs.prune-unlisted-missing }}" ]; then
EXTRA_OPTS="$EXTRA_OPTS --prune-unlisted-missing ${{ inputs.prune-unlisted-missing }}"
fi
echo "Running clean with: $EXTRA_OPTS"
jbang --java 21+ $APP --version
jbang --java 21+ $APP clean $EXTRA_OPTS
- name: Commit & Push changes
id: commit
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7
if: inputs.do_commit
with:
commit_message: "Clean up repository data"
branch: ${{ inputs.branch || github.ref_name }}
- name: Upload log files
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
if: always()
with:
name: clean-logs
path: logs/**/*.log
retention-days: 30