Skip to content

Commit e757c4f

Browse files
committed
Check generated files are up-to-date
1 parent e617250 commit e757c4f

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

.github/actions/setup/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ inputs:
1111
description: "INI values to pass along to setup-php action"
1212
required: false
1313
default: ""
14+
working-directory:
15+
description: "The directory where composer.json is located, if it is not in the repository root."
16+
required: false
1417

1518
runs:
1619
using: composite
@@ -49,3 +52,4 @@ runs:
4952
# Revert when psalm supports PHP 8.4
5053
# composer-options: "--no-suggest"
5154
composer-options: "--no-suggest ${{ inputs.php-version == '8.4' && '--ignore-platform-req=php+' || '' }}"
55+
working-directory: "${{ inputs.working-directory }}"

.github/workflows/generator.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Generator"
2+
3+
on:
4+
merge_group:
5+
pull_request:
6+
branches:
7+
- "v*.*"
8+
- "master"
9+
- "feature/*"
10+
push:
11+
branches:
12+
- "v*.*"
13+
- "master"
14+
- "feature/*"
15+
workflow_call:
16+
inputs:
17+
ref:
18+
description: "The git ref to check"
19+
type: string
20+
required: true
21+
22+
env:
23+
PHP_VERSION: "8.2"
24+
# TODO: change to "stable" once 1.20.0 is released
25+
# DRIVER_VERSION: "stable"
26+
DRIVER_VERSION: "mongodb/mongo-php-driver@v1.20"
27+
28+
jobs:
29+
psalm:
30+
name: "Diff check"
31+
runs-on: "ubuntu-22.04"
32+
33+
steps:
34+
- name: "Checkout"
35+
uses: "actions/checkout@v4"
36+
with:
37+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }}
38+
39+
- name: "Setup"
40+
uses: "./.github/actions/setup"
41+
with:
42+
php-version: ${{ env.PHP_VERSION }}
43+
driver-version: ${{ env.DRIVER_VERSION }}
44+
working-directory: "generator"
45+
46+
- name: "Run Generator"
47+
run: "generator/generate"
48+
49+
- name: "Check file diff"
50+
run: git add . -N && git diff --exit-code

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"vimeo/psalm": "^5.13"
2828
},
2929
"replace": {
30-
"mongodb/builder": ">= 0.2"
30+
"mongodb/builder": "*"
3131
},
3232
"autoload": {
3333
"psr-4": { "MongoDB\\": "src/" },

0 commit comments

Comments
 (0)