2022-12-26 15:42:39 +00:00
|
|
|
name: ✨ WordPress Plugins - Update
|
2023-01-05 10:56:27 +00:00
|
|
|
|
2022-12-26 15:42:39 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2023-01-05 10:56:27 +00:00
|
|
|
|
2022-12-26 15:42:39 +00:00
|
|
|
jobs:
|
|
|
|
Update:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out repository code
|
2023-09-12 10:36:40 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-12-26 15:42:39 +00:00
|
|
|
with:
|
|
|
|
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
|
|
|
|
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
|
|
|
|
|
|
|
|
- name: Install Python3
|
2023-12-11 05:07:43 +00:00
|
|
|
uses: actions/setup-python@v5
|
2022-12-26 15:42:39 +00:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
- run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install -r .github/scripts/wordpress-plugins-update-requirements.txt
|
|
|
|
|
|
|
|
- name: Update Templates
|
2022-12-29 08:34:11 +00:00
|
|
|
id: update-templates
|
2022-12-26 15:42:39 +00:00
|
|
|
run: |
|
|
|
|
python3 .github/scripts/wordpress-plugins-update.py
|
|
|
|
git status -s | wc -l | xargs -I {} echo CHANGES={} >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Commit files
|
2022-12-29 08:34:11 +00:00
|
|
|
if: steps.update-templates.outputs.CHANGES > 0
|
2022-12-26 15:42:39 +00:00
|
|
|
run: |
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "GitHub Action"
|
2022-12-29 08:34:11 +00:00
|
|
|
git add --all
|
|
|
|
git commit -m "Auto WordPress Plugins Update [$(date)] :robot:"
|
2022-12-26 15:42:39 +00:00
|
|
|
|
|
|
|
- name: Push changes
|
2022-12-29 08:34:11 +00:00
|
|
|
if: steps.update-templates.outputs.CHANGES > 0
|
2022-12-26 15:42:39 +00:00
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
2022-12-29 08:45:17 +00:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2022-12-26 15:42:39 +00:00
|
|
|
branch: ${{ github.ref }}
|