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 Packages and Create Pull Request | |
on: | |
schedule: | |
- cron: '0 0 * * 1' # Weekly on Mondays | |
push: | |
branches: | |
- wip | |
paths-ignore: | |
- .idea/** | |
- docs/** | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update-packages: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout Code | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Step 2: Set Up PHP | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
tools: composer | |
# Step 3: Add Guzzle Dependency | |
- name: Add Guzzle Dependency | |
run: composer require guzzlehttp/guzzle:^7.4 | |
# Step 4: Install Dependencies | |
- name: Install Dependencies | |
run: composer install | |
# Step 5: Reset Composer Changes | |
- name: Reset Composer Changes | |
run: git checkout -- composer.json composer.lock | |
# Step 6: Run Update Script and Commit Changes | |
- name: Run Update Script | |
run: | | |
set -o xtrace | |
TIMESTAMP=$(date +'%Y%m%d%H%M%S') | |
BRANCH_NAME="update-packages-${TIMESTAMP}" | |
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_ENV | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git checkout -b $BRANCH_NAME | |
git fetch | |
php .github/update_packages.php | |
git status | |
git add -A | |
echo $BRANCH_NAME | |
git commit -m "Update dependencies in packages.yml" | |
git rebase origin/develop | |
git push -u origin HEAD | |
git show-branch HEAD origin/develop origin/$BRANCH_NAME | |
# Step 7: Create Pull Request | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ env.branch_name }} | |
base: develop | |
title: "Update packages.yml with latest versions" | |
body: | | |
This pull request updates the `packages.yml` file with the latest stable versions of dependencies. | |
labels: dependencies |