Skip to content

Commit

Permalink
Merge branch 'main' into fix/adapt-branch-alias
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 2, 2023
2 parents 8526659 + ad8446b commit b9ff6ff
Show file tree
Hide file tree
Showing 30 changed files with 77 additions and 396 deletions.
11 changes: 6 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

# From https://github.com/WordPress/wordpress-develop/blob/trunk/.editorconfig with a couple of additions.

root = true

[*]
Expand All @@ -13,13 +15,12 @@ insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[{.jshintrc,*.json,*.yml,*.feature}]
[{*.yml,*.feature,.jshintrc,*.json}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[{*.txt,wp-config-sample.php}]
end_of_line = crlf

[composer.json]
indent_style = space
indent_size = 4
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ updates:
open-pull-requests-limit: 10
labels:
- scope:distribution
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- scope:distribution

85 changes: 2 additions & 83 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,87 +7,6 @@ on:
- main
- master

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

lint: #-----------------------------------------------------------------------
name: Lint PHP files
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v2

- name: Check existence of composer.json file
id: check_composer_file
uses: andstor/file-existence-action@v1
with:
files: "composer.json"

- name: Set up PHP environment
if: steps.check_composer_file.outputs.files_exists == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: cs2pr
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Composer dependencies & cache dependencies
if: steps.check_composer_file.outputs.files_exists == 'true'
uses: "ramsey/composer-install@v2"
env:
COMPOSER_ROOT_VERSION: 'dev-main'

- name: Check existence of vendor/bin/parallel-lint file
id: check_linter_file
uses: andstor/file-existence-action@v1
with:
files: "vendor/bin/parallel-lint"

- name: Run Linter
if: steps.check_linter_file.outputs.files_exists == 'true'
run: vendor/bin/parallel-lint -j 10 . --exclude vendor --checkstyle | cs2pr

phpcs: #----------------------------------------------------------------------
name: PHPCS
runs-on: ubuntu-latest

steps:
- name: Check out source code
uses: actions/checkout@v2

- name: Check existence of composer.json & phpcs.xml.dist files
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "composer.json, phpcs.xml.dist"

- name: Set up PHP environment
if: steps.check_files.outputs.files_exists == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: cs2pr
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Composer dependencies & cache dependencies
if: steps.check_files.outputs.files_exists == 'true'
uses: "ramsey/composer-install@v2"
env:
COMPOSER_ROOT_VERSION: 'dev-main'

- name: Check existence of vendor/bin/phpcs file
id: check_phpcs_binary_file
uses: andstor/file-existence-action@v1
with:
files: "vendor/bin/phpcs"

- name: Run PHPCS
if: steps.check_phpcs_binary_file.outputs.files_exists == 'true'
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
code-quality:
uses: wp-cli/.github/.github/workflows/reusable-code-quality.yml@main
97 changes: 4 additions & 93 deletions .github/workflows/regenerate-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,98 +7,9 @@ on:
- main
- master
paths-ignore:
- 'features/**'
- 'README.md'

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

- "features/**"
- "README.md"

jobs:

regenerate-readme: #----------------------------------------------------------
name: Regenerate README.md file
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'wp-cli' && ! contains(fromJson('[".github", "wp-cli", "wp-cli-bundle", "wp-super-cache-cli", "php-cli-tools", "wp-config-transformer"]'), github.event.repository.name) }}
steps:
- name: Check out source code
uses: actions/checkout@v2

- name: Set up PHP envirnoment
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check existence of composer.json file
id: check_composer_file
uses: andstor/file-existence-action@v1
with:
files: "composer.json"

- name: Install Composer dependencies & cache dependencies
if: steps.check_composer_file.outputs.files_exists == 'true'
uses: "ramsey/composer-install@v2"
env:
COMPOSER_ROOT_VERSION: 'dev-main'

- name: Configure git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "Alain Schlesser"
- name: Check if remote branch exists
id: remote-branch
run: echo ::set-output name=exists::$([[ -z $(git ls-remote --heads origin regenerate-readme) ]] && echo "0" || echo "1")

- name: Create branch to base pull request on
if: steps.remote-branch.outputs.exists == 0
run: |
git checkout -b regenerate-readme
- name: Fetch existing branch to add commits to
if: steps.remote-branch.outputs.exists == 1
run: |
git fetch --all --prune
git checkout regenerate-readme
git pull --no-rebase
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar
sudo mv wp-cli-nightly.phar /usr/local/bin/wp
sudo chmod +x /usr/local/bin/wp
- name: Regenerate README.md file
run: |
wp package install "wp-cli/scaffold-package-command:^2"
wp scaffold package-readme --force .
- name: Check if there are changes
id: changes
run: echo ::set-output name=changed::$([[ -z $(git status --porcelain) ]] && echo "0" || echo "1")

- name: Commit changes
if: steps.changes.outputs.changed == 1
run: |
git add README.md
git commit -m "Regenerate README file - $(date +'%Y-%m-%d')"
git push origin regenerate-readme
- name: Create pull request
if: |
steps.changes.outputs.changed == 1 &&
steps.remote-branch.outputs.exists == 0
uses: repo-sync/pull-request@v2
with:
source_branch: regenerate-readme
destination_branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: Regenerate README file
pr_body: "**This is an automated pull-request**\n\nRefreshes the `README.md` file with the latest changes to the docblocks in the source code."
pr_reviewer: schlessera
pr_label: scope:documentation
regenerate-readme:
uses: wp-cli/.github/.github/workflows/reusable-regenerate-readme.yml@main
Loading

0 comments on commit b9ff6ff

Please sign in to comment.