Update Metabase Version #2
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
name: Update Metabase Version | |
on: | |
schedule: | |
- cron: '0 4 * * 0' | |
workflow_dispatch: | |
jobs: | |
update_metabase: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Get latest Metabase release version | |
id: get_version | |
run: | | |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/metabase/metabase/releases/latest | jq -r .tag_name) | |
echo "version=$LATEST_RELEASE" >> $GITHUB_OUTPUT | |
- name: Run update_files.py | |
run: | | |
python update-version.py ${{ steps.get_version.outputs.version }} | |
- name: Check if workspace is dirty | |
id: check_dirty | |
run: | | |
if [[ -n $(git status --porcelain) ]]; then | |
echo "is_dirty=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_dirty=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create pull request if workspace is dirty | |
if: steps.check_dirty.outputs.is_dirty == 'true' | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
commit-message: "Update Metabase to ${{ steps.get_version.outputs.version }}" | |
title: "Update Metabase to ${{ steps.get_version.outputs.version }}" | |
body: "This PR updates the Metabase version to ${{ steps.get_version.outputs.version }}." | |
branch: update-metabase-${{ steps.get_version.outputs.version }} |