Skip to content

Commit

Permalink
GitHub Actionの追加
Browse files Browse the repository at this point in the history
  • Loading branch information
hajime-tsukamoto committed Aug 9, 2023
1 parent 41b79e4 commit 8bee822
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: php-cs-fixer
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
php-cs-fixer:
runs-on: ubuntu-20.04
steps:
- name: Setup PHP 7.4
run: sudo update-alternatives --set php /usr/bin/php7.4
- uses: actions/checkout@master
- name: git setting
run: |
git config --local user.email "info@hajimecreate.com"
git config --local user.name "Hajimecreate"
- name: Prepare
run: |
wget https://cs.symfony.com/download/php-cs-fixer-v2.phar -O php-cs-fixer
chmod a+x php-cs-fixer
- name: php-cs-fixer
run: php php-cs-fixer fix . --config=php_cs.dist
- uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Run Prettier
run: |
npx prettier --write '**/*.{js,json,md,scss,css,html}' --tab-width 4
- name: Commit and Push
run: |
line=`git diff | wc -l`
if [ $line -eq 0 ]; then
echo "コミットするものがないので終了"
exit 0
fi
git add .
git commit -m "Code fix by Github Action" -a
git pull
git push origin HEAD
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/AccessTokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AccessTokenController extends Controller

public function __construct()
{
$this->version = 'v13.0';
$this->version = 'v17.0';
$this->host = 'https://graph.facebook.com/';
$this->base_url = $this->host . $this->version;
$this->url_for_access_token2 = $this->base_url . '/oauth/access_token';
Expand Down
81 changes: 81 additions & 0 deletions php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => true,
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_return' => true,
'blank_line_before_statement' => [
'statements' => [
'break',
'continue',
'declare',
'return',
'throw',
'try'
]
],
'braces' => [
'allow_single_line_closure' => false,
'position_after_anonymous_constructs' => 'same',
'position_after_control_structures' => 'same',
'position_after_functions_and_oop_constructs' => 'next',
],
'cast_spaces' => [
'space' => 'single'
],
'concat_space' => [
'spacing' => 'one'
],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'declare_strict_types' => false,
'function_declaration' => [
'closure_function_spacing' => 'one', // クロージャーのfunctionの後ろのスペース
],
'full_opening_tag' => true,
'function_typehint_space' => true,
'no_superfluous_phpdoc_tags' => false,
'phpdoc_no_package' => false,
'general_phpdoc_annotation_remove' => [
'annotations' => ['author'],
],
'phpdoc_separation' => false,
'phpdoc_align' => [
'align' => 'vertical',
],
'include' => true,
'increment_style' => [
'style' => 'pre'
],
'is_null' => true,
'line_ending' => true,
'lowercase_cast' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'trailing_comma_in_multiline_array' => false,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => [
'use' => 'echo'
],
'no_multiline_whitespace_around_double_arrow' => true,
'no_short_echo_tag' => true,
'no_superfluous_elseif' => true,
'no_useless_else' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_unneeded_control_parentheses' => [
'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield']
],
])
->setUsingCache(false)
->setFinder(PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
);

0 comments on commit 8bee822

Please sign in to comment.