-
-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Rector to commit 955a5de414501f77b80b321a90ee35d4fe49e9e2
rectorphp/rector-src@955a5de Add gitlab to "setup-ci" command (#5497)
- Loading branch information
1 parent
29d3544
commit 744ab2e
Showing
7 changed files
with
119 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare (strict_types=1); | ||
namespace Rector\Git; | ||
|
||
use RectorPrefix202401\Nette\Utils\Strings; | ||
use RectorPrefix202401\Symfony\Component\Process\Process; | ||
final class RepositoryHelper | ||
{ | ||
/** | ||
* @var string | ||
* @see https://regex101.com/r/etcmog/2 | ||
*/ | ||
private const GITHUB_REPOSITORY_REGEX = '#github\\.com[:\\/](?<repository_name>.*?)\\.git#'; | ||
public static function resolveGithubRepositoryName(string $currentDirectory) : ?string | ||
{ | ||
// resolve current repository name | ||
$process = new Process(['git', 'remote', 'get-url', 'origin'], $currentDirectory, null, null, null); | ||
$process->run(); | ||
$output = $process->getOutput(); | ||
$match = Strings::match($output, self::GITHUB_REPOSITORY_REGEX); | ||
return $match['repository_name'] ?? null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
stages: | ||
- setup | ||
- rector | ||
- commit_changes | ||
|
||
setup: | ||
stage: setup | ||
# see https://github.com/thecodingmachine/docker-images-php | ||
image: thecodingmachine/php:8.2-v4-slim-cli | ||
|
||
rector: | ||
stage: rector | ||
script: | ||
- vendor/bin/rector --ansi | ||
# @todo apply coding standard if used | ||
|
||
commit_changes: | ||
stage: commit_changes | ||
script: | ||
- git config --global user.email "ci@gitlab.com" | ||
- git config --global user.name "GitLab CI | ||
# - git checkout $CI_COMMIT_REF_NAME | ||
- git add . | ||
- git commit -m "[rector] Rector fixes" | ||
- git push origin $CI_COMMIT_REF_NAME | ||
only: | ||
- merge_requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters