-
Notifications
You must be signed in to change notification settings - Fork 68
75 lines (71 loc) · 2.96 KB
/
bump_metallb.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
# Note: If this is failing to create pull requests, it can be triaged
# by inspecting the workflow run under the actions tab in github.
name: Periodic MetalLB Bump
on:
schedule:
# every day at 7am & 7pm (GMT+2)
- cron: "0 5,17 * * *"
jobs:
bump-metallb-and-create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Metal LB Operator
uses: actions/checkout@v3
with:
path: metallboperator
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: metallb/metallb
path: metallb
fetch-depth: 0
- name: Get current metallb commit hash
id: old-metallb
run: |
echo "commit_sha=$(cat metallboperator/hack/metallb_ref.txt)" >> $GITHUB_OUTPUT
- name: Get old commit info
id: old-commit-info
run: |
cd metallb
echo "commit_title=$(git log -1 --pretty=%s ${{ steps.old-metallb.outputs.commit_sha }})" >> $GITHUB_OUTPUT
echo "commit_date=$(git log -n1 --pretty='format:%cd' --date=format:'%Y-%m-%d' ${{ steps.old-metallb.outputs.commit_sha }})" >> $GITHUB_OUTPUT
- name: Get new commit info
id: new-commit-info
run: |
cd metallb
echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "commit_title=$(git log -1 --pretty=%s HEAD)" >> $GITHUB_OUTPUT
echo "commit_date=$(git log -n1 --pretty='format:%cd' --date=format:'%Y-%m-%d' HEAD)" >> $GITHUB_OUTPUT
- name: Check if there are changes
id: check-for-changes
run: |
if [[ ${{ steps.old-metallb.outputs.commit_sha }} == ${{ steps.new-commit-info.outputs.commit_sha }} ]]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump metallb
if: ${{ steps.check-for-changes.outputs.has_changes == 'true' }}
run: make bump_metallb
- name: Create pull request
if: ${{ steps.check-for-changes.outputs.has_changes == 'true'}}
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
Bump MetalLB
This commit bumps MetalLB:
from: ${{ steps.old-metallb.outputs.commit_sha }}
${{ steps.old-commit-info.outputs.commit_title }} (${{ steps.old-commit-info.outputs.commit_date }})
to: ${{ steps.new-commit-info.outputs.commit_sha }}
${{ steps.new-commit-info.outputs.commit_title }} (${{ steps.new-commit-info.outputs.commit_date }})
author: github-actions[bot] <[email protected]>
committer: github-actions[bot] <[email protected]>
signoff: true
title: "Bump MetalLB"
branch: "bumpmetallb"
delete-branch: true
base: "main"