Skip to content

Commit c2f193b

Browse files
committed
t
1 parent 84b6e25 commit c2f193b

File tree

2 files changed

+14
-33
lines changed

2 files changed

+14
-33
lines changed

.github/workflows/styling.yml

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ concurrency:
4040
cancel-in-progress: true
4141
jobs:
4242
CODE_FORMATTING_CHECK:
43-
name: CODE_FORMATTING_CHECK
43+
name: Code formatting check
4444
# if: github.repository_owner == 'php' || github.event_name == 'pull_request'
4545
runs-on: ubuntu-latest
4646
steps:
47-
- name: git checkout
47+
- name: Checkout repository
4848
uses: actions/checkout@v4
4949
with:
5050
fetch-depth: 0
51-
- name: apt
51+
- name: Install packages
5252
run: |
5353
set -x
5454
sudo apt-get update
@@ -57,37 +57,18 @@ jobs:
5757
clang-format \
5858
php-cli \
5959
netcat-openbsd
60-
- name: check code formatting
60+
- name: Check code formatting
6161
run: |
6262
set -x
63-
git fetch origin master
64-
git diff origin/master > ../master.diff
65-
if [ -f scripts/dev/format_pull_request.php ]; then
66-
cp scripts/dev/format_pull_request.php ..
67-
fi
68-
git checkout master
69-
if [ -f scripts/dev/format_pull_request.php ]; then
70-
cp scripts/dev/format_pull_request.php ..
71-
fi
72-
if [ ! -f ../format_pull_request.php ]; then
73-
echo "error: format_pull_request.php does not exist" 1>&2
74-
exit 1
75-
fi
76-
git reset --hard origin/master
77-
php ../format_pull_request.php ../master.diff > ../formatted.diff
78-
if [ -s ../formatted.diff ]; then
79-
cat ../formatted.diff
80-
echo "code formatting check failed :("
81-
patch_url=$(cat ../formatted.diff | nc termbin.com 9999)
82-
echo "Please run"
83-
echo "curl $patch_url | git apply -v"
84-
exit 1
85-
else
86-
echo "code formatting check succeeded :)"
87-
exit 0
88-
fi
63+
echo "foobar" > format.patch
8964
- name: 'Upload artifacts'
9065
uses: actions/upload-artifact@v4
9166
with:
9267
name: 'format.patch'
93-
path: ../formatted.diff
68+
path: format.patch
69+
if-no-files-found: ignore
70+
- name: 'Show summary'
71+
run: |
72+
echo 'Artifact ID is ${{ steps.artifact-upload-step.outputs.artifact-id }}'
73+
echo 'Artifact ID is ${{ steps.artifact-upload-step.outputs.artifact-url }}'
74+
cat 'Run curl ${{ steps.artifact-upload-step.outputs.artifact-url }} | git patch apply' > $GITHUB_STEP_SUMMARY

scripts/dev/format_pull_request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
$argv = array_values($argv);
1515
$argc = count($argv);
1616
}
17-
if ($argc !== 2) {
17+
if ($argc !== 2 || in_array('--help', $argv, true)) {
1818
ob_start();
1919
echo "Usage: php {$argv[0]} [diff-uri]\n";
2020
echo "example:\nphp {$argv[0]} " . escapeshellarg('https://github.com/php/php-src/pull/13401.diff') . "\n";
2121
fwrite(STDERR, ob_get_clean());
22-
exit(1);
22+
exit(in_array('--help', $argv, true) === true ? 0 : 1);
2323
}
2424
// check if we're already in php-src
2525
if (is_dir("Zend")) {

0 commit comments

Comments
 (0)