ci(gitea): shared composite actions + pipeline generator for Gitea Actions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AqpXh3hQMMaC74pTjFq4it Gitea 1.25 cannot run reusable workflows (workflow_call), so the logic of deploy-app.yml, smoke.yml and ci.yml moves into composite actions under .gitea/actions/, and each repo gets a thin pipeline rendered by tools/gitea-pipeline/render.py from repos.json. .github/workflows is left untouched (Gitea ignores it once .gitea/workflows exists).
This commit is contained in:
65
.gitea/actions/ci-phpcs/action.yml
Normal file
65
.gitea/actions/ci-phpcs/action.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
name: CI - PHPCS
|
||||
description: >-
|
||||
WordPress Coding Standards (Gitea port of the phpcs job). On pull_request with
|
||||
autofix enabled, runs phpcbf and pushes fixes back to the PR branch; the caller
|
||||
must check out the PR head ref with a token that can push.
|
||||
inputs:
|
||||
autofix:
|
||||
required: false
|
||||
default: 'true'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
coverage: none
|
||||
tools: composer:v2, phpcs
|
||||
|
||||
- name: Install WordPress Coding Standards
|
||||
shell: bash
|
||||
run: |
|
||||
composer global config --no-plugins \
|
||||
allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
|
||||
composer global require --no-interaction \
|
||||
"dealerdirect/phpcodesniffer-composer-installer:^1.0" \
|
||||
"wp-coding-standards/wpcs:^3.0" \
|
||||
"phpcsstandards/phpcsutils:^1.0" \
|
||||
"phpcsstandards/phpcsextra:^1.0"
|
||||
|
||||
- name: Auto-fix with phpcbf (PR only, commit back if changed)
|
||||
if: ${{ github.event_name == 'pull_request' && inputs.autofix == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
PHPCS_CONFIG=""
|
||||
if [ -f phpcs.xml ]; then PHPCS_CONFIG="phpcs.xml"
|
||||
elif [ -f phpcs.xml.dist ]; then PHPCS_CONFIG="phpcs.xml.dist"
|
||||
elif [ -f .phpcs.xml.dist ]; then PHPCS_CONFIG=".phpcs.xml.dist"
|
||||
fi
|
||||
if [ -z "$PHPCS_CONFIG" ]; then echo "No phpcs config - phpcbf skipped."; exit 0; fi
|
||||
phpcbf --standard="$PHPCS_CONFIG" --extensions=php \
|
||||
--ignore=vendor/*,tests/*,node_modules/* . || true
|
||||
if ! git diff --quiet; then
|
||||
git config user.name "peptiderepo-ops"
|
||||
git config user.email "ops@peptiderepo.com"
|
||||
git add -A
|
||||
git commit -m "style: auto-fix PHPCS violations via phpcbf"
|
||||
git push
|
||||
fi
|
||||
|
||||
- name: Run PHPCS strict (fail on remaining violations)
|
||||
shell: bash
|
||||
run: |
|
||||
PHPCS_CONFIG=""
|
||||
if [ -f phpcs.xml ]; then PHPCS_CONFIG="phpcs.xml"
|
||||
elif [ -f phpcs.xml.dist ]; then PHPCS_CONFIG="phpcs.xml.dist"
|
||||
elif [ -f .phpcs.xml.dist ]; then PHPCS_CONFIG=".phpcs.xml.dist"
|
||||
fi
|
||||
if [ -z "$PHPCS_CONFIG" ]; then
|
||||
echo "No phpcs.xml / phpcs.xml.dist / .phpcs.xml.dist found - PHPCS skipped."
|
||||
exit 0
|
||||
fi
|
||||
phpcs --standard="$PHPCS_CONFIG" --extensions=php \
|
||||
--ignore=vendor/*,tests/*,node_modules/* \
|
||||
--warning-severity=0 --report=full .
|
||||
Reference in New Issue
Block a user