-
-
Notifications
You must be signed in to change notification settings - Fork 154
75 lines (59 loc) · 2.3 KB
/
auto-regenerate.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
name: "Auto Regenerate"
on:
schedule:
- cron: '0 3 * * *'
jobs:
auto-regenerate:
name: "Tries to regenerate the files"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "8.0"
- name: "Check out salathe/phpdoc-base"
uses: "actions/checkout@v2"
with:
path: "generator/doc/doc-en/doc-base"
repository: "salathe/phpdoc-base"
- name: "Check out php/doc-en"
uses: "actions/checkout@v2"
with:
path: "generator/doc/doc-en/en"
repository: "php/doc-en"
- name: "Install dependencies with composer in generator/ directory"
run: "composer install --no-interaction"
working-directory: "generator"
- name: "Install dependencies with composer in root/ directory"
run: "composer install --no-interaction"
- name: "Dump autoloader with composer in root directory"
run: "composer dump-autoload"
- name: "Regenerate files"
run: "./safe.php generate"
working-directory: "generator"
- name: "Check if regenerated files are different"
run: |
if output=$(git status --porcelain) && [ -z "$output" ]; then
# all is good
echo "Generated files are the same as committed file: OK"
else
# Uncommitted changes
echo "Generated files are different from commited files. Please run './safe.php generate' command and commit the results."
echo "Detected changes:"
git status
git diff
echo "Generated files are different from commited files. Please run './safe.php generate' command and commit the results."
exit 1;
fi
- name: "Create a pr if the files are different"
if: ${{ failure() }}
uses: peter-evans/create-pull-request@v3
with:
commit-message: "Automatically regenerate the files"
branch: create-pull-request/regenerate-files
title: "Automatically regenerate the files"
labels: "regenerate, auto"
assignees: "kharhamel, moufmouf"