-
Notifications
You must be signed in to change notification settings - Fork 24
101 lines (91 loc) · 3.29 KB
/
Copy pathforce-bump-pull-request.yaml
File metadata and controls
101 lines (91 loc) · 3.29 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
name: Generate a PR to bump openstack-k8s-operators dependencies
on:
workflow_call:
inputs:
operator_name:
required: true
type: string
branch_name:
default: 'main'
type: string
custom_image:
default: 'quay.io/openstack-k8s-operators/openstack-k8s-operators-ci-build-tools:latest'
type: string
secrets:
FORCE_BUMP_PULL_REQUEST_PAT:
required: false
jobs:
force-bump-pr:
name: Generate a pull request update to the latest openstack-k8s-operators dependencies for the selected operator
runs-on: ubuntu-latest
container:
image: ${{ inputs.custom_image }}
options: --user root
env:
CUSTOM_TOOLS_PATH: /tmp/workspace/bin
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_name }}
- name: Git config
run: |
# Fix git ownership issue in container
git config --global --add safe.directory $GITHUB_WORKSPACE
cd $GITHUB_WORKSPACE
git config user.name "openstack-k8s-operators-ci"
git config user.email "openstack-k8s-operators-ci@github.com"
- name: run make force-bump, tidy, manifests, generate
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PATH: ${{ env.CUSTOM_TOOLS_PATH }}:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LOCALBIN: ${{ env.CUSTOM_TOOLS_PATH }}
GOTOOLCHAIN: local
run: |
cd $GITHUB_WORKSPACE
go work init
make gowork
BRANCH='${{ inputs.branch_name }}' make force-bump
go work sync
make tidy
make manifests generate
- name: run make bindata
if: inputs.operator_name == 'openstack'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PATH: ${{ env.CUSTOM_TOOLS_PATH }}:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LOCALBIN: ${{ env.CUSTOM_TOOLS_PATH }}
GOTOOLCHAIN: local
run: |
cd $GITHUB_WORKSPACE
make bindata
- name: Detect if there are local git changes and set a variable
id: git_diff
run: |
cd $GITHUB_WORKSPACE
if git diff --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Set token
id: token
run: |
if [ -z "${{ secrets.FORCE_BUMP_PULL_REQUEST_PAT }}" ]; then
echo "token=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_OUTPUT"
else
echo "token=${{ secrets.FORCE_BUMP_PULL_REQUEST_PAT }}" >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
if: steps.git_diff.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.token.outputs.token }}
title: "openstack-k8s-operators dependency bump branch: ${{ inputs.branch_name }}"
branch: "openstack-dependency-bump/${{ inputs.branch_name }}"
commit-message: "Update openstack-k8s-operators (${{ inputs.branch_name }})"
committer: openstack-k8s-operators-ci <openstack-k8s-operators-ci@github.com>
author: openstack-k8s-operators-ci <openstack-k8s-operators-ci@github.com>
labels: ok-to-test