Skip to content

Update stubs

Update stubs #2445

Workflow file for this run

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Update stubs"
on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * *'
jobs:
update:
name: "Update stubs"
runs-on: "ubuntu-latest"
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit
- name: "Checkout to commit"
if: github.event_name != 'pull_request'
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
ref: ${{ github.head_ref }}
fetch-depth: '0'
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
- name: "Checkout to only read"
if: github.event_name == 'pull_request'
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: "Install PHP"
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
with:
coverage: "none"
php-version: "8.3"
- name: "Install dependencies"
run: "composer install"
working-directory: ./extractor
- name: "Checkout"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
repository: "php/php-src"
path: "php-src"
ref: "PHP-8.0"
- name: "Extract stubs"
run: "./extractor/extract.php"
# repeat
- name: "Delete checked out php-src repo"
run: "rm -rf php-src"
- name: "Checkout PHP 8.1"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
repository: "php/php-src"
path: "php-src"
ref: "PHP-8.1"
- name: "Update stubs"
run: "./extractor/extract.php --update -- 8.0 8.1"
# ---
- name: "Delete checked out php-src repo"
run: "rm -rf php-src"
- name: "Checkout PHP 8.2"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
repository: "php/php-src"
path: "php-src"
ref: "PHP-8.2"
- name: "Update stubs"
run: "./extractor/extract.php --update -- 8.1 8.2"
# ---
- name: "Delete checked out php-src repo"
run: "rm -rf php-src"
- name: "Checkout PHP 8.3"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
repository: "php/php-src"
path: "php-src"
ref: "PHP-8.3"
- name: "Update stubs"
run: "./extractor/extract.php --update -- 8.2 8.3"
# ---
- name: "Delete checked out php-src repo"
run: "rm -rf php-src"
- name: "Checkout PHP 8.4"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
repository: "php/php-src"
path: "php-src"
ref: "PHP-8.4"
- name: "Update stubs"
run: "./extractor/extract.php --update -- 8.3 8.4"
# ---
- name: "Delete checked out php-src repo"
run: "rm -rf php-src"
- name: "Checkout PHP 8.5"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
repository: "php/php-src"
path: "php-src"
ref: "PHP-8.5"
- name: "Update stubs"
run: "./extractor/extract.php --update -- 8.4 8.5"
# end repeat
- name: 'Get previous tag'
id: previous_tag
uses: "WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.0
with:
fallback: 0.1.0
- name: 'Get next minor version'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@d079934efaf011a4cf8912d4637097fe35d32b93" # v1
with:
version: ${{ steps.previous_tag.outputs.tag }}
- name: "Commit changes"
if: github.event_name != 'pull_request'
uses: "stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0" # v6.0.1
id: "commit"
with:
commit_message: "Update stubs"
commit_user_name: "phpstan-bot"
commit_user_email: "ondrej+phpstanbot@mirtes.cz"
commit_author: "phpstan-bot <ondrej+phpstanbot@mirtes.cz>"
tagging_message: ${{ steps.semvers.outputs.patch }}
- name: "Show diff"
if: github.event_name == 'pull_request'
run: "git diff"