Periodic MetalLB Bump #1185
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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@v4 | |
with: | |
path: metallboperator | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
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@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Bump metallb | |
if: ${{ steps.check-for-changes.outputs.has_changes == 'true' }} | |
run: make bump_metallb | |
- uses: tibdex/github-app-token@v1 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.AUTO_BUMP_APP_ID }} | |
private_key: ${{ secrets.AUTO_BUMP_APP_PRIVATE_KEY }} | |
- name: Create pull request | |
if: ${{ steps.check-for-changes.outputs.has_changes == 'true'}} | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ steps.generate-token.outputs.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" |