Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Sep 22, 2023
2 parents 0280297 + c4bd34e commit e6015fa
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 41 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/label-add-conflict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Auto Add Label "stale" & Comment Conflicts

on:
push:
branches:
- develop
- '4.*'
pull_request:
branches:
- develop
- '4.*'

jobs:
auto-label-comment-conflict:

permissions:
contents: read
pull-requests: write

runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get PR List
id: PR-list
run: echo "pr_list=$(gh pr list -L 100 --json mergeable,url,labels,author)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'Add label "stale" and comment'
env:
PR_LIST: ${{ steps.PR-list.outputs.pr_list }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
IFS=$'\n' # Set Internal Field Separator to newline to handle array elements
# Iterate through the PRs in PR_LIST
for pr in $(echo "$PR_LIST" | jq -c '.[]'); do
mergeable=$(echo "$pr" | jq -r '.mergeable')
author=$(echo "$pr" | jq -r '.author.login')
labels=$(echo "$pr" | jq -c '.labels[].name' | tr -d '[]"')
url=$(echo "$pr" | jq -r '.url')
# CONFLICTING and no 'stale' label
if [ "$mergeable" == "CONFLICTING" ] && [[ ! "$labels" == *"stale"* ]]; then
# Add "stale" label
gh pr edit $url --add-label "stale"
# Add a comment
gh pr comment $url --body ":wave: Hi, @$author!<br><br>We detected conflicts in your PR against the base branch :speak_no_evil:<br>You may want to sync :arrows_counterclockwise: your branch with upstream!<br><br>Ref: [Syncing Your Branch](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#pushing-your-branch)"
fi
done
33 changes: 0 additions & 33 deletions .github/workflows/label-conflict.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/label-remove-conflict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Auto Remove "stale" label

on:
pull_request:
branches:
- develop
- '4.*'

jobs:
check-conflict:
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get PR Detail
id: PR-detail
run: echo "detail=$(gh pr view $PR_URL --json mergeable,url,labels,author)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}

- name: 'Remove label "stale"'
env:
PR_DETAIL: ${{ steps.PR-detail.outputs.detail }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
# MERGEABLE with 'stale' label
if [ "$(echo $PR_DETAIL | jq -r '.mergeable')" == "MERGEABLE" ] && \
[ "$(echo $PR_DETAIL | jq -r '.labels[] | select(.name == "stale")')" != "" ]; then
# remove 'stale' label
gh pr edit $PR_URL --remove-label "stale"
fi
5 changes: 4 additions & 1 deletion .github/workflows/reusable-coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ jobs:
run: composer update --ansi

- name: Merge coverage files
run: vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
run: |
jq '.autoload."psr-4" += {"Config\\": "app/Config/"}' composer.json > temp.json && mv temp.json composer.json
composer dump-autoload
vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
- name: Upload coverage to Coveralls
run: vendor/bin/php-coveralls --verbose --exclude-no-stmt --ansi
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -3031,11 +3031,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 2,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:add\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
'count' => 1,
Expand Down
5 changes: 3 additions & 2 deletions system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ public function __construct(FileLocator $locator, Modules $moduleConfig, Routing

// Normalize the path string in routeFiles array.
foreach ($this->routeFiles as $routeKey => $routesFile) {
$this->routeFiles[$routeKey] = realpath($routesFile) ?: $routesFile;
$realpath = realpath($routesFile);
$this->routeFiles[$routeKey] = ($realpath === false) ? $routesFile : $realpath;
}
}

Expand Down Expand Up @@ -1680,7 +1681,7 @@ public function resetRoutes()
*/
protected function loadRoutesOptions(?string $verb = null): array
{
$verb = $verb ?: $this->getHTTPVerb();
$verb ??= $this->getHTTPVerb();

$options = $this->routesOptions[$verb] ?? [];

Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/database/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ within the class' constructor:

.. literalinclude:: configuration/008.php

.. _database-config-with-env-file:

**************************
Configuring with .env File
**************************
Expand Down
6 changes: 6 additions & 0 deletions user_guide_src/source/general/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ are considered for merging into the configuration object's properties.
.. important:: You cannot add a new property by setting environment variables,
nor change a scalar value to an array. See :ref:`env-var-replacements-for-data`.

.. note:: This feature is implemented in the ``CodeIgniter\Config\BaseConfig``
class. So it will not work with a few files in the **app/Config** folder
that do not extends the class.

If the prefix of a namespaced variable exactly matches the namespace of the configuration
class, then the trailing part of the setting (after the dot) is treated as a configuration
property. If it matches an existing configuration property, the environment variable's
Expand Down Expand Up @@ -233,6 +237,8 @@ expect your ``Config\App`` to magically have that property and value at run time
When you have the property ``$default = ['encrypt' => false]`` in your
``Config\Database``, you cannot change the ``encrypt`` value to an array even if
you put ``database.default.encrypt.ssl_verify = true`` in your **.env**.
If you want to do like that, see
:ref:`Database Configuration <database-config-with-env-file>`.

Treating Environment Variables as Arrays
========================================
Expand Down

0 comments on commit e6015fa

Please sign in to comment.