diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e1023fb6..77d70bc5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,19 +16,14 @@ jobs: php: - '8.0' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 + - uses: ibexa/gh-workflows/actions/composer-install@main with: - php-version: ${{ matrix.php }} - coverage: none - extensions: 'pdo_sqlite, gd' - tools: cs2pr - - - uses: "ramsey/composer-install@v1" - with: - dependency-versions: "highest" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} - name: Run code style check run: composer run-script check-cs -- --format=checkstyle | cs2pr @@ -44,27 +39,24 @@ jobs: php: - '7.3' - '7.4' - - '8.0' - - '8.1' + - '8.3' + - '8.4' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 + - uses: ibexa/gh-workflows/actions/composer-install@main with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_sqlite, gd - tools: cs2pr - - - uses: "ramsey/composer-install@v1" - with: - dependency-versions: "highest" - composer-options: "--prefer-dist --no-progress" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Run PHPStan analysis + run: composer run-script phpstan + - name: Run test suite run: composer run-script --timeout=600 test diff --git a/src/Command/LinkDependenciesCommand.php b/src/Command/LinkDependenciesCommand.php index 75bb1dbd..957c478b 100644 --- a/src/Command/LinkDependenciesCommand.php +++ b/src/Command/LinkDependenciesCommand.php @@ -48,7 +48,7 @@ class LinkDependenciesCommand extends Command */ private $tokenProvider; - public function __construct(string $outputDirectory = null, ComposerLocalTokenProvider $tokenProvider = null) + public function __construct(?string $outputDirectory = null, ?ComposerLocalTokenProvider $tokenProvider = null) { parent::__construct(); $this->serializer = new Serializer([new ObjectNormalizer()], [new JsonEncoder()]); @@ -170,7 +170,10 @@ private function analyzeDependencies(array $pullRequestUrls): Dependencies foreach ($pullRequestUrls as $pullRequestUrl) { $matches = []; - preg_match('/.*github.com\/(.*)\/(.*)\/pull\/(\d+).*/', $pullRequestUrl, $matches); + if (preg_match('/.*github.com\/(.*)\/(.*)\/pull\/(\d+).*/', $pullRequestUrl, $matches) !== 1) { + // Skip invalid PR URLs + continue; + } [, $owner, $repository, $prNumber] = $matches; $prNumber = (int)$prNumber;