Update Codebase on Upgrade #464
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
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 */4 * * *" | |
push: | |
branches: [ MasterPi-2124/upgrades-tracker ] | |
name: Update Codebase on Upgrade | |
jobs: | |
get_upgrades: | |
name: Get all current upgrades | |
runs-on: ubuntu-latest | |
outputs: | |
chain-jobs: ${{ steps.generate.outputs.jobs }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
cd .github/workflows/utility/upgrades | |
python -m pip install requests | |
- name: Check for Upgrades | |
shell: python | |
run: | | |
import sys | |
sys.path.insert(1, '.github/workflows/utility/upgrades') | |
import getUpgrades | |
getUpgrades.run() | |
- name: Generate Chains | |
id: generate | |
run: | | |
chains="$(cat .github/workflows/utility/upgrades/chainsUpdated.json)" | |
echo "Found these upgrades: $jobs" | |
echo "chains=$chains" >> $GITHUB_OUTPUT | |
- name: Add Commit Push | |
uses: devops-infra/action-commit-push@master | |
id: add_commit | |
if: steps.generate.outputs.chains != '[""]' | |
with: | |
github_token: "${{ secrets.GITHUB_TOKEN }}" | |
add_timestamp: false | |
commit_prefix: "[AUTO]" | |
commit_message: "codebase update: ${{ steps.generate.outputs.chains }}" | |
force: false | |
target_branch: codebase-upgrade | |
- name: Create A PR | |
uses: devops-infra/[email protected] | |
if: ${{ needs.add_commit }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
source_branch: codebase-upgrade | |
target_branch: master | |
title: Codebase updates | |
body: "Chains Updated: ${{ steps.generate.outputs.chains }}" | |
old_string: "**THIS IS AN AUTOMATED UPDATE OF CHAIN.JSON**" | |
new_string: "** Automatic pull request**" | |
get_diff: true | |
ignore_users: "dependabot" |