-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (58 loc) · 1.93 KB
/
20-generate.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
# based on https://github.com/mvdan/github-actions-golang
name: Generate
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
generate:
if: (github.actor != 'github-actions[bot]')
permissions:
contents: write
pull-requests: write
strategy:
matrix:
php-version: [8.1]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: grpc, protobuf
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Install Protoc
uses: arduino/setup-protoc@v2
# cache php dependencies
- uses: actions/cache@v3
with:
path: |
~/.composer/cache
vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
- name: Get current submodule hash
run: echo "COMMIT_HASH=$(git rev-parse HEAD:proto)" >> $GITHUB_ENV
- name: Update submodules
run: git submodule update --init --recursive --remote
- name: Clean up
run: rm -fr src
- name: Lint proto files
run: make protolint
- name: Generate proto files
run: make proto
- name: Fix directory structure
run: mv src/IDBI/PHPProto/* src && rm -fr src/IDBI
- name: Get commits since last COMMIT_HASH in submodule
run: |
cd proto
echo "COMMIT_MSG=$(git log --no-merges --pretty=format:"%s [gsols/proto-apis@%H]" --reverse $COMMIT_HASH..HEAD)" >> $GITHUB_ENV
cd ..
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: "${{env.COMMIT_MSG}}"
title: "Build proto files using remote submodule"
body: "${{env.COMMIT_MSG}}"