-
Notifications
You must be signed in to change notification settings - Fork 20
86 lines (86 loc) · 3.75 KB
/
security.yml
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
name: Security workflow
on:
schedule:
- cron: '0 13 * * *'
pull_request:
push:
branches:
- '*'
jobs:
dependency-audit:
name: Dependency Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Find the push source branch name
if: ${{ github.event_name != 'pull_request' }}
run: echo "AZ_TRIMMED_REF=${GITHUB_REF#refs/*/}" >> ${GITHUB_ENV}
- name: Find the pull request source branch name
if: ${{ github.event_name == 'pull_request' }}
run: echo "AZ_TRIMMED_REF=${GITHUB_HEAD_REF}" >> ${GITHUB_ENV}
- name: Set variables
run: |
if [ $(git ls-remote --heads https://github.com/az-digital/az-quickstart-scaffolding.git $AZ_TRIMMED_REF | wc -l) = 1 ]; then
echo "SCAFFOLD_BRANCH=${AZ_TRIMMED_REF}" >> ${GITHUB_ENV}
else
echo "SCAFFOLD_BRANCH=main" >> ${GITHUB_ENV}
fi
if [ $(git ls-remote --heads https://github.com/az-digital/az-quickstart-dev.git $AZ_TRIMMED_REF | wc -l) = 1 ]; then
echo "DEV_PACKAGE_BRANCH=${AZ_TRIMMED_REF}" >> ${GITHUB_ENV}
else
echo "DEV_PACKAGE_BRANCH=main" >> ${GITHUB_ENV}
fi
- name: Clone scaffolding repo
uses: actions/checkout@v4
with:
repository: az-digital/az-quickstart-scaffolding
path: az-quickstart-scaffolding
ref: ${{ env.SCAFFOLD_BRANCH }}
- name: Install dependencies
run: |
cd az-quickstart-scaffolding
composer config repositories.az_quickstart vcs https://github.com/az-digital/az_quickstart.git
composer config use-github-api false
./quickstart_branch.sh --branch ${AZ_TRIMMED_REF}
composer require --no-update --dev az-digital/az-quickstart-dev:dev-${DEV_PACKAGE_BRANCH}
composer install -o
- name: Check dependencies for vulnerabilities
uses: symfonycorp/security-checker-action@v5
with:
lock: az-quickstart-scaffolding/composer.lock
code-check:
name: Static Code Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Find the push source branch name
if: ${{ github.event_name != 'pull_request' }}
run: echo "AZ_TRIMMED_REF=${GITHUB_REF#refs/*/}" >> ${GITHUB_ENV}
- name: Find the pull request source branch name
if: ${{ github.event_name == 'pull_request' }}
run: echo "AZ_TRIMMED_REF=${GITHUB_HEAD_REF}" >> ${GITHUB_ENV}
- name: Install dependencies
run: |
if [ $(git ls-remote --heads https://github.com/az-digital/az-quickstart-scaffolding.git $AZ_TRIMMED_REF | wc -l) = 1 ]; then SCAFFOLD_BRANCH="$AZ_TRIMMED_REF"; else SCAFFOLD_BRANCH=main; fi
if [ $(git ls-remote --heads https://github.com/az-digital/az-quickstart-dev.git $AZ_TRIMMED_REF | wc -l) = 1 ]; then DEV_PACKAGE_BRANCH="$AZ_TRIMMED_REF"; else DEV_PACKAGE_BRANCH=main; fi
git clone --branch $SCAFFOLD_BRANCH https://github.com/az-digital/az-quickstart-scaffolding.git
cd az-quickstart-scaffolding
composer config repositories.az_quickstart vcs https://github.com/az-digital/az_quickstart.git
composer config use-github-api false
./quickstart_branch.sh --branch ${AZ_TRIMMED_REF}
composer require --no-update --dev az-digital/az-quickstart-dev:dev-${DEV_PACKAGE_BRANCH}
composer install -o
- name: Run static code analysis
run: |
cd az-quickstart-scaffolding
composer phpcs