generated from bfra-me/github-action
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yaml
225 lines (216 loc) · 10.7 KB
/
action.yaml
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
---
name: Renovate Action
description: Self-hosted Renovate GitHub Action
author: bfra.me
inputs:
autodiscover:
description: Autodiscover all repositories.
required: false
default: 'false'
branch:
description: Run Renovate on this branch.
required: false
cache:
description: Enable the Renovate cache.
required: false
default: 'false'
dry_run:
deprecationMessage: Use the `dry-run` input instead. This input will be removed in a future major release.
description: Perform a dry run by logging messages instead of creating/updating/deleting branches and PRs.
required: false
default: 'false'
dry-run:
description: Perform a dry run by logging messages instead of creating/updating/deleting branches and PRs.
required: false
default: 'false'
log_level:
deprecationMessage: Use the `log-level` input instead. This input will be removed in a future major release.
description: Set the log level.
required: false
default: 'info'
log-level:
description: Set the log level.
required: false
default: 'info'
print_config:
deprecationMessage: Use the `print-config` input instead. This input will be removed in a future major release.
description: Log the fully-resolved Renovate config for each repository, plus fully-resolved presets.
required: false
default: 'false'
print-config:
description: Log the fully-resolved Renovate config for each repository, plus fully-resolved presets.
required: false
default: 'false'
renovate_app_id:
deprecationMessage: Use the `renovate-app-id` input instead. This input will be removed in a future major release.
description: The ID of the GitHub App that will be used to run Renovate.
required: false
renovate-app-id:
description: The ID of the GitHub App that will be used to run Renovate.
required: true
renovate_app_pem:
deprecationMessage: Use the `renovate-app-private-key` input instead. This input will be removed in a future major release.
description: The private key of the GitHub App that will be used to run Renovate.
required: false
renovate-app-private-key:
description: The private key of the GitHub App that will be used to run Renovate.
required: true
renovate_app_slug:
deprecationMessage: The `renovate_app_slug` input is deprecated and will be removed in a future major release.
description: The slug of the GitHub app to use for authentication.
required: false
outputs:
docker-image:
description: The name of the Renovate Docker image
value: ${{ steps.configure.outputs.docker-image }}
renovate-version:
description: The Renovate version
value: ${{ steps.configure.outputs.renovate-version }}
runs:
steps:
- id: get-renovate-app
name: Get Renovate GitHub App Installation
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
with:
app-id: ${{ inputs.renovate-app-id || inputs.renovate_app_id }}
private-key: ${{ inputs.renovate-app-private-key || inputs.renovate_app_pem }}
owner: ${{ github.repository_owner }}
- name: Configure
id: configure
env:
RENOVATE_VERSION: 38.142.7 # renovate: datasource=docker depName=renovate packageName=ghcr.io/renovatebot/renovate versioning=semver
autodiscover: ${{ inputs.autodiscover != '' && inputs.autodiscover || 'false' }}
dry_run: ${{ inputs.dry-run != '' && inputs.dry-run || inputs.dry_run != '' && inputs.dry_run || 'false' }}
log_level: ${{ inputs.log-level != '' && inputs.log-level || inputs.log_level != '' && inputs.log_level || 'info' }}
print_config: ${{ inputs.print-config != '' && inputs.print-config || inputs.print_config != '' && inputs.print_config || 'false' }}
renovate_app_id: ${{ inputs.renovate-app-id || inputs.renovate_app_id }}
renovate_app_slug: ${{ steps.get-renovate-app.outputs.app-slug }}
cache: ${{ inputs.cache == 'true' }}
zzglobal_config: |-
{
allowedPostUpgradeCommands: [
'^(npx )?corepack(?:@\\d+(?:\\.\\d+\\.\\d+)?)? enable$',
'^npm ci( --force)?( --ignore-scripts)?$',
'^npm install -g (npm|pnpm|yarn)(?:@\\d+(?:\\.\\d+\\.\\d+)?)?$',
'^(?:p?npx|pnpm|yarn) prettier(?:@\\d+(?:\\.\\d+\\.\\d+)?)?( --no-color)? --write \\.$',
'^(pnpm|yarn) install( --force)?( --frozen-lockfile)?( --ignore-scripts)?$',
'^(?:npm|pnpm|yarn)(?:\\srun)?\\s(?:bootstrap|build(-release)?|clean|fix|format|update-snapshots)$',
'^yarn install( --force)?( --immutable)?( --immutable-cache)?$',
'^(?:\\[ -w \\.npmrc \\] && )?git checkout -- \\.npmrc(?: \\|\\| true)?$',
],
description: [
'Use the global config preset for the @bfra-me organization.',
'_See the [self-hosted Renovate action](https://github.com/bfra-me/renovate-action/blob/main/action.yaml) for details._',
],
onboardingConfig: {
'$schema': 'https://docs.renovatebot.com/renovate-schema.json',
extends: ['github>bfra-me/renovate-config'],
},
onboardingConfigFileName: '.github/renovate.json5',
onboardingPrTitle: 'feat(deps): configure Renovate',
onboardingRebaseCheckbox: true,
}
run: |
renovate_username="${{ env.renovate_app_slug }}[bot]"
renovate_git_author_email="${{ env.renovate_app_id }}+${renovate_username}@users.noreply.github.com"
renovate_git_author="${renovate_username} <${renovate_git_author_email}>"
# Create outputs for this configuration
sed 's/^[[:space:]]*//' <<EOF >> $GITHUB_OUTPUT
autodiscover=${{ env.autodiscover }}
base-branches=${{ inputs.branch && format('["{0}"]', inputs.branch) || '' }}
cache-dir=${RENOVATE_CACHE_DIR:-/tmp/renovate/cache}
cache-key=renovate-cache-v$(echo ${{ env.RENOVATE_VERSION }} | cut -d. -f1)
docker-image=ghcr.io/renovatebot/renovate:${{ env.RENOVATE_VERSION }}
dry-run=${{ env.dry_run }}
enable-cache=${{ env.cache }}
global-config=$(echo "${zzglobal_config}" | tr -d '\n')
log-level=${{ env.log_level }}
print-config=${{ env.print_config }}
renovate-git-author-email=${renovate_git_author_email}
renovate-git-author=${renovate_git_author}
renovate-username=${renovate_username}
renovate-version=${{ env.RENOVATE_VERSION }}
EOF
shell: 'bash -Eeuo pipefail {0}'
- name: Restore Renovate Cache
id: renovate-cache
if: steps.configure.outputs.enable-cache == 'true'
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
enableCrossOsArchive: true
key: ${{ steps.configure.outputs.cache-key }}
path: ${{ steps.configure.outputs.cache-dir }}
- name: Prepare Renovate Cache
if: steps.configure.outputs.enable-cache == 'true'
run: |
[ -d /tmp/renovate ] && sudo chown -R runneradmin:root /tmp/renovate || true
shell: 'bash -Eeuo pipefail {0}'
- name: Renovate ${{ steps.configure.outputs.renovate-version }}
uses: renovatebot/github-action@28bcd5c4900a4353b5c9af9e1bd61dd6377f0f0d # v40.3.5
env:
FORCE_COLOR: '3'
LOG_LEVEL: ${{ steps.configure.outputs.log-level }}
RENOVATE_AUTODISCOVER: 'true'
RENOVATE_AUTODISCOVER_FILTER: ${{ steps.configure.outputs.autodiscover == 'false' && github.repository || '' }}
RENOVATE_BASE_BRANCHES: ${{ steps.configure.outputs.base-branches }}
RENOVATE_USE_BASE_BRANCH_CONFIG: ${{ steps.configure.outputs.base-branches && 'merge' || 'none' }}
RENOVATE_BRANCH_PREFIX_OLD: 'renovate-github/'
RENOVATE_CACHE_DIR: ${{ steps.configure.outputs.cache-dir }}
RENOVATE_CONFIG: ${{ steps.configure.outputs.global-config }}
RENOVATE_DEPENDENCY_DASHBOARD_FOOTER: '\n- [ ] <!-- manual job -->Check here to trigger a Renovate run on this repository\n'
RENOVATE_DRY_RUN: ${{ fromJSON(steps.configure.outputs.dry-run) && 'full' || '' }}
RENOVATE_GIT_AUTHOR: ${{ steps.configure.outputs.renovate-git-author }}
RENOVATE_GIT_IGNORED_AUTHORS: |-
[
"29139614+renovate[bot]@users.noreply.github.com",
"118100583+bfra-me[bot]@users.noreply.github.com",
"137683033+mrbro-bot[bot]@users.noreply.github.com",
"109017866+fro-bot[bot]@users.noreply.github.com",
"${{ steps.configure.outputs.renovate-git-author-email }}"
]
RENOVATE_HOST_RULES: |-
[
{
"abortIgnoreStatusCodes": [404],
"abortOnError": true
}
]
RENOVATE_PLATFORM: github
RENOVATE_PRESET_CACHE_PERSISTENCE: ${{ steps.configure.outputs.enable-cache == 'true' }}
RENOVATE_PRINT_CONFIG: ${{ steps.configure.outputs.print-config }}
RENOVATE_REPOSITORY_CACHE: ${{ steps.configure.outputs.enable-cache == 'true' && 'enabled' || 'disabled' }}
RENOVATE_USERNAME: ${{ steps.configure.outputs.renovate-username }}
with:
env-regex: '^(?:CI|FORCE_COLOR|GITHUB_(?:(?!PATH|ENV).)+|(?:HTTPS?|NO)_PROXY|(?:https?|no)_proxy|LOG_LEVEL|NODE_OPTIONS|RENOVATE_\w+|RUNNER_\w+)$'
docker-cmd-file: '${{ github.action_path }}/docker/entrypoint.sh'
docker-user: root
mount-docker-socket: true
renovate-version: ${{ steps.configure.outputs.renovate-version }}
token: ${{ steps.get-renovate-app.outputs.token }}
- name: Finalize Renovate Cache
if: |
(success() || failure()) &&
steps.configure.outputs.enable-cache == 'true' &&
steps.renovate-cache.outputs.cache-hit != 'true' || github.event_name == 'push'
env:
GH_REPO: ${{ github.event.repository.full_name }}
GH_TOKEN: ${{ steps.get-renovate-app.outputs.token }}
run: |
[ -d /tmp/renovate ] && sudo chown -R $(whoami) /tmp/renovate
gh api -X DELETE /repos/{owner}/{repo}/actions/caches?key=${{ steps.configure.outputs.cache-key }} ||
echo "Could not delete cache for $GH_REPO"
shell: 'bash -Eeuo pipefail {0}'
- name: Save Renovate cache
if: |
(success() || failure()) &&
steps.configure.outputs.enable-cache == 'true' &&
steps.renovate-cache.outputs.cache-hit != 'true' || github.event_name == 'push'
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
enableCrossOsArchive: true
key: ${{ steps.configure.outputs.cache-key }}
path: ${{ steps.configure.outputs.cache-dir }}
using: composite