Skip to content

Update github-actions #2586

Update github-actions

Update github-actions #2586

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@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: "Checkout to commit"
if: github.event_name != 'pull_request'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: "Install PHP"
uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # 2.37.2
with:
coverage: "none"
php-version: "8.3"
- name: "Install dependencies"
run: "composer install"
working-directory: ./extractor
- name: "Checkout"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@61819f33034117e6c686e6a31dba995a85afc9de" # v2.0.0
with:
fallback: 0.1.0
- name: 'Get next minor version'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930" # v1.2.1
with:
version: ${{ steps.previous_tag.outputs.tag }}
- name: "Commit changes"
if: github.event_name != 'pull_request'
uses: "stefanzweifel/git-auto-commit-action@4a55954c782fc1ea30b9056cd3e7a2b40ca8887d" # v7.2.0
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"