Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
phpstan/phpstan-action.bash at master · php-actions/phpstan · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
php-actions
phpstan
Repository navigation
Code
Issues
8
(8)
Pull requests
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
phpstan
/
phpstan-action.bash
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
118 lines (99 loc) · 2.47 KB
master
Breadcrumbs
phpstan
/
phpstan-action.bash
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
118 lines (99 loc) · 2.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!
/bin/bash
set
-e
github_action_path=
$(
dirname
"
$0
"
)
docker_tag=
$(
cat ./docker_tag
)
echo
"
Docker tag:
$docker_tag
"
>>
output.log
2>&1
if
[
"
$ACTION_VERSION
"
=
"
composer
"
]
then
VENDOR_BIN=
"
vendor/bin/phpstan
"
if
test
-f
"
$VENDOR_BIN
"
then
ACTION_PHPSTAN_PATH=
"
$VENDOR_BIN
"
else
echo
"
Trying to use version installed by Composer, but there is no file at
$ACTION_PHPSTAN_PATH
"
exit
1
fi
fi
if
[
-z
"
$ACTION_PHPSTAN_PATH
"
]
then
phar_url=
"
https://www.getrelease.download/phpstan/phpstan/
$ACTION_VERSION
/phar
"
phar_path=
"
${github_action_path}
/phpstan.phar
"
curl --silent -H
"
User-agent: cURL (https://github.com/php-actions)
"
-L
"
$phar_url
"
>
"
$phar_path
"
else
phar_path=
"
${GITHUB_WORKSPACE}
/
$ACTION_PHPSTAN_PATH
"
fi
if
[
!
-x
"
$phar_path
"
]
;
then
chmod +x
"
$phar_path
"
fi
command_string=(
"
phpstan
"
)
if
[
-n
"
$ACTION_COMMAND
"
]
then
command_string+=(
"
$ACTION_COMMAND
"
)
fi
if
[
-n
"
$ACTION_PATH
"
]
then
IFS=
"
"
read
-r -a splitIFS
<<<
"
$ACTION_PATH
"
for
path
in
"
${splitIFS[@]}
"
do
command_string+=(
"
$path
"
)
done
fi
if
[
-n
"
$ACTION_CONFIGURATION
"
]
then
command_string+=(--configuration=
"
$ACTION_CONFIGURATION
"
)
fi
if
[
-n
"
$ACTION_LEVEL
"
]
then
command_string+=(--level=
"
$ACTION_LEVEL
"
)
fi
if
[
-n
"
$ACTION_PATHS_FILE
"
]
then
command_string+=(--paths-file=
"
$ACTION_PATHS_FILE
"
)
fi
if
[
-n
"
$ACTION_AUTOLOAD_FILE
"
]
then
command_string+=(--autoload-file=
"
$ACTION_AUTOLOAD_FILE
"
)
fi
if
[
-n
"
$ACTION_ERROR_FORMAT
"
]
then
command_string+=(--error-format=
"
$ACTION_ERROR_FORMAT
"
)
fi
if
[
-n
"
$ACTION_GENERATE_BASELINE
"
]
then
command_string+=(--generate-baseline=
"
$ACTION_GENERATE_BASELINE
"
)
fi
if
[
-n
"
$ACTION_MEMORY_LIMIT
"
]
then
command_string+=(--memory-limit=
"
$ACTION_MEMORY_LIMIT
"
)
fi
command_string+=(--ansi)
if
[
-n
"
$ACTION_ARGS
"
]
then
command_string+=(
$ACTION_ARGS
)
fi
dockerKeys=()
while
IFS=
read
-r line
do
dockerKeys+=(
$(
echo
"
$line
"
|
cut -f1 -d=
)
)
done
<<<
$(
docker
run --rm
"
${docker_tag}
"
env)
while
IFS=
read
-r line
do
key=
$(
echo
"
$line
"
|
cut -f1 -d=
)
if
printf
'
%s\n
'
"
${dockerKeys[@]}
"
|
grep -q -P
"
^
${key}
\$
"
then
echo
"
Skipping env variable
$key
"
>>
output.log
else
echo
"
$line
"
>>
DOCKER_ENV
fi
done
<<<
$(
env
)
echo
"
Command:
"
"
${command_string[@]}
"
>>
output.log
2>&1
docker run --rm \
--volume
"
$phar_path
"
:/usr/local/bin/phpstan \
--volume
"
${GITHUB_WORKSPACE}
/vendor/phpstan:/usr/local/phpstan
"
\
--volume
"
${GITHUB_WORKSPACE}
"
:/app \
--workdir /app \
--env-file ./DOCKER_ENV \
--network host \
${docker_tag}
"
${command_string[@]}
"
You can’t perform that action at this time.