-
Notifications
You must be signed in to change notification settings - Fork 2
118 lines (111 loc) · 3.77 KB
/
rebake.yml
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
---
name: "Rebake Cookie"
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
cookie:
description: "The cookie to rebake"
type: "string"
default: ""
draft:
description: "Whether to create the pull request as a draft"
type: "string"
default: ""
pull-request:
description: "The pull request strategy"
type: "string"
default: ""
template:
description: "The template repository URL"
type: "string"
default: ""
template-dir:
description: "The directory within the template repository to use as the template"
type: "string"
default: ""
template-ref:
description: "The branch or tag to use for the template"
type: "string"
default: ""
drift-manager-tag:
description: "The drift manager Docker image tag to use"
type: "string"
default: "latest"
workflow_dispatch:
inputs:
cookie:
description: "The cookie to rebake"
type: "string"
default: ""
draft:
description: "Whether to create the pull request as a draft"
type: "string"
default: ""
pull-request:
description: "The pull request strategy"
type: "string"
default: ""
template:
description: "The template repository URL"
type: "string"
default: ""
template-dir:
description: "The directory within the template repository to use as the template"
type: "string"
default: ""
template-ref:
description: "The branch or tag to use for the template"
type: "string"
default: ""
drift-manager-tag:
description: "The drift manager Docker image tag to use"
type: "string"
default: "latest"
jobs:
rebake:
runs-on: "ubuntu-22.04"
permissions:
actions: "write"
contents: "write"
packages: "read"
pull-requests: "write"
container: "ghcr.io/nautobot/cookiecutter-nautobot-app-drift-manager/prod:${{ github.event.inputs.drift-manager-tag }}"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
- name: "Configure Rebake Arguments"
id: "config"
shell: "bash"
run: |
ARGS='--push'
if [[ '${{ github.event.inputs.draft }}' == 'true' ]]; then
ARGS="$ARGS --draft"
elif [[ '${{ github.event.inputs.draft }}' == 'false' ]]; then
ARGS="$ARGS --no-draft"
elif [[ '${{ github.event.inputs.draft }}' == '' ]]; then
echo "Using repo default value for --draft"
else
echo "ERROR: Invalid value for draft: '${{ github.event.inputs.draft }}'"
exit 1
fi
if [[ '${{ github.event.inputs.pull-request }}' != '' ]]; then
ARGS="$ARGS --pull-request='${{ github.event.inputs.pull-request }}'"
fi
if [[ '${{ github.event.inputs.template }}' != '' ]]; then
ARGS="$ARGS --template='${{ github.event.inputs.template }}'"
fi
if [[ '${{ github.event.inputs.template-dir }}' != '' ]]; then
ARGS="$ARGS --template-dir='${{ github.event.inputs.template-dir }}'"
fi
if [[ '${{ github.event.inputs.template-ref }}' != '' ]]; then
ARGS="$ARGS --template-ref='${{ github.event.inputs.template-ref }}'"
fi
if [[ '${{ github.event.inputs.cookie }}' == '' ]]; then
ARGS="$ARGS '${{ github.repositoryUrl }}'"
else
ARGS="$ARGS '${{ github.event.inputs.cookie }}'"
fi
echo "args=$ARGS" >> $GITHUB_OUTPUT
- name: "Rebake"
run: |
python -m ntc_cookie_drift_manager rebake ${{ steps.config.outputs.args }}