Check Polkadot and Cumulus Update #145
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: Check Polkadot and Cumulus Update | |
on: | |
push: | |
schedule: | |
- cron: '0 0 * * *' # Runs at midnight UTC every day | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyyaml requests | |
- name: Check for updates in Polkadot and replace version if needed | |
id: check-update-polkadot | |
run: | | |
python scripts/extract_version.py group_vars/polkadot.yaml default_client_version paritytech polkadot-sdk true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check for updates in Cumulus and replace version if needed | |
id: check-update-cumulus | |
run: | | |
python scripts/extract_version.py group_vars/cumulus.yaml default_client_version paritytech polkadot-sdk true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Git config | |
if: steps.check-update-polkadot.outputs.current_version != steps.check-update-polkadot.outputs.latest_release | |
|| steps.check-update-cumulus.outputs.current_version != steps.check-update-cumulus.outputs.latest_release | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Commit updated YAML files | |
if: steps.check-update-polkadot.outputs.current_version != steps.check-update-polkadot.outputs.latest_release | |
|| steps.check-update-cumulus.outputs.current_version != steps.check-update-cumulus.outputs.latest_release | |
run: | | |
git add group_vars/polkadot.yaml group_vars/cumulus.yaml | |
git commit -m "Update Polkadot and Cumulus versions" | |
git push | |
- name: Create Pull Request for Polkadot and Cumulus Update | |
if: steps.check-update-polkadot.outputs.current_version != steps.check-update-polkadot.outputs.latest_release | |
|| steps.check-update-cumulus.outputs.current_version != steps.check-update-cumulus.outputs.latest_release | |
uses: repo-sync/pull-request@v2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pr_title: "Update Polkadot and Cumulus versions" | |
pr_body: "Automatically updated by GitHub Actions." | |
pr_label: "automated-pr" |