enomotodev/php-cs-fixer-commit

创建php-cs-fixer的提交

v1.1.1 2021-10-05 07:50 UTC

This package is auto-updated.

Last update: 2024-09-05 14:40:58 UTC


README

安装

$ composer require --dev enomotodev/php-cs-fixer-commit

使用(GitHub + GitHub Actions)

创建工作流程文件

.github/workflows中,添加一个.yml或.yaml文件以定义你的工作流程。

例如,.github/workflows/php-cs-fixer-commit.yml

name: php-cs-fixer-commit

on:
  push:

jobs:
  php-cs-fixer-commit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Dependencies
        run: composer install
      - name: php-cs-fixer-commit
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: ./vendor/bin/php-cs-fixer-commit <username> <email>

注意:请确保将<username><email>替换为你的用户名和电子邮件。

使用(GitHub + CircleCI)

将GitHub个人访问令牌设置为CircleCI

发送拉取请求到你的仓库需要GitHub个人访问令牌。

  1. 访问你的账户设置页面并生成一个具有“repo”范围的个人访问令牌。
  2. 在CircleCI仪表板上,转到你的应用程序的“项目设置”->“环境变量”
  3. 添加一个名为GITHUB_ACCESS_TOKEN的环境变量,并使用你的GitHub个人访问令牌进行设置

配置circle.yml

配置你的circle.yml.circleci/config.yml以运行php-cs-fixer-commit,例如

version: 2

jobs:
  build:
    # ...
    fixer:
      steps:
        # ...
        - run:
            name: php-cs-fixer-commit
            command: ./vendor/bin/php-cs-fixer-commit <username> <email>

注意:请确保将<username><email>替换为你的用户名和电子邮件。

使用(GitLab + GitLabCI)

将GitLab个人访问令牌设置为GitLabCI

发送合并请求到你的仓库需要GitLab个人访问令牌。

  1. 访问你的账户设置页面并生成一个具有“api”范围的个人访问令牌。
  2. 在GitLab仪表板上,转到你的应用程序的“设置”->“CI / CD”->“环境变量”
  3. 添加一个名为GITLAB_API_PRIVATE_TOKEN的环境变量,并使用你的GitLab个人访问令牌进行设置

配置.gitlab-ci.yml

配置你的.gitlab-ci.yml以运行php-cs-fixer-commit,例如

stages:
  # ...
  - fixer

# ...

fixer-commit:
  image: composer:latest
  stage: fixer
  script:
    - "composer install"
    - "$COMPOSER_HOME/vendor/bin/php-cs-fixer-commit <username> <email>"

注意:请确保将<username><email>替换为你的用户名和电子邮件。

许可

php-cs-fixer-commit是开源软件,受MIT许可许可。