Build WordPress stubs #937
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: Build WordPress stubs | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'fixtures.php' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-stubs: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DEPLOYBOT_SSH_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ssh-key: ${{ secrets.DEPLOYBOT_SSH_PRIVATE_KEY }} | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.0 | |
coverage: none | |
- name: Install dependencies | |
uses: ramsey/composer-install@v3 | |
- name: Generate stubs | |
run: php generate.php | |
- name: Add, commit, and push | |
run: | | |
git config user.email ${{ secrets.DEPLOYBOT_EMAIL }} | |
git config user.name ${{ secrets.DEPLOYBOT_USER }} | |
git config --add safe.directory "${GITHUB_WORKSPACE}" | |
git add ./stubs/* | |
git add ./packages.json | |
git commit -m "Update WordPress stubs" || ((echo "NO_CHANGES=yes" >> $GITHUB_ENV) && (echo "No changes to commit")) | |
- name: Update reference and push | |
if: ${{ env.NO_CHANGES != 'yes' }} | |
run: | | |
php update_reference.php "$(git rev-parse HEAD)" | |
git add ./packages.json | |
git commit -m "Update packages.json references" | |
git push |