Skip to content

Commit

Permalink
Merge pull request #1 from yardinternet/feat/add-more-workflows
Browse files Browse the repository at this point in the history
Feat/add more workflows
  • Loading branch information
FreakyWizard authored Nov 18, 2024
2 parents 205fbcb + 78bf6a0 commit 808c8e1
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/composer-lock-diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Composer Diff

on:
- workflow_call

jobs:
composer-diff:
name: Composer Diff
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to make it possible to compare with PR base branch

- name: Generate composer diff
id: composer_diff # To reference the output in comment
uses: IonBazan/composer-diff-action@v1

- uses: marocchino/sticky-pull-request-comment@v2
# An empty diff result will break this action.
if: ${{ steps.composer_diff.outputs.composer_diff_exit_code != 0 }}
with:
header: composer-diff # Creates a collapsed comment with the report
message: |
<details>
<summary>Composer package changes</summary>
${{ steps.composer_diff.outputs.composer_diff }}
</details>
1 change: 1 addition & 0 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Dependabot automerge

on:
- workflow_call

Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/format-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PHP CS Fixer

on:
- workflow_call

jobs:
php-cs-fixer:
name: php-cs-fixer
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: composer:v2
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.YARD_BOT_PAT }}

- name: Install composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Run PHPStan
run: ./vendor/bin/php-cs-fixer fix

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: '(auto): apply php-cs-fixer changes'
push_options: '--force'
env:
GITHUB_TOKEN: ${{ secrets.YARD_BOT_PAT }}
18 changes: 18 additions & 0 deletions .github/workflows/markdown-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: linting

on:
- workflow_call

jobs:
lint:
name: Markdown Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: DavidAnson/markdownlint-cli2-action@v17
with:
globs: |
*.md
config: .markdownlint.yml
20 changes: 20 additions & 0 deletions .github/workflows/npm-lock-diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: NPM Lockfile Changes

on:
- workflow_call

jobs:
lockfile_changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to make it possible to compare with PR base branch
- name: NPM Lockfile Changes
uses: rvanvelzen/npm-lockfile-changes@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PHPStan

on:
- workflow_call

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: composer:v2
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.YARD_BOT_PAT }}

- name: Install composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Dirty fix for previously defined function (packages using php-stubs)
run: [ -f ./vendor/php-stubs/wordpress-stubs/wordpress-stubs.php ] && sed -i -e 's#function __(#function ____(#' ./vendor/php-stubs/wordpress-stubs/wordpress-stubs.php

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
6 changes: 6 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MD010: { "spaces_per_tab": 4 }
MD013: false
MD024: { "siblings_only": true }
MD025: false
MD033: false
MD036: false
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Workflows

Github Actions used in projects of the WordPress team.

- PHPStan
- Dependabot (auto-merge)
-

0 comments on commit 808c8e1

Please sign in to comment.