Skip to content

Commit 0b78612

Browse files
authored
chore: Change verify-changed-files Github action (#550)
1 parent 8818b83 commit 0b78612

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

.github/workflows/autoupdate-preview.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,28 @@ jobs:
2020
env:
2121
API_BASE_URL: https://raw.githubusercontent.com/mongodb/openapi/refs/heads/dev/openapi/v2
2222
- name: Verify Changed files
23-
uses: tj-actions/verify-changed-files@4a3570896cbdc5dca56a7a259fba88667845e18a
24-
id: verify-changed-files
25-
with:
26-
files: |
27-
**/atlas-api.yaml
23+
run: |
24+
FILES_CHANGED=false
25+
if git diff --name-only | grep -qE '^openapi/atlas-api.yaml'; then
26+
FILES_CHANGED=true
27+
fi
28+
echo "FILES_CHANGED=${FILES_CHANGED}" >> "$GITHUB_ENV"
2829
- name: Run generation
29-
if: steps.verify-changed-files.outputs.files_changed == 'true'
30+
if: env.FILES_CHANGED == 'true'
3031
working-directory: ./tools
3132
run: |
3233
export PATH=${PATH}:`go env GOPATH`/bin
3334
make clean_and_generate
3435
- name: Update Preview version
35-
if: steps.verify-changed-files.outputs.files_changed == 'true'
36+
if: env.FILES_CHANGED == 'true'
3637
working-directory: ./tools
3738
run: make preview-version
3839
- name: Run mock generation
3940
working-directory: ./tools
40-
if: steps.verify-changed-files.outputs.files_changed == 'true'
41+
if: env.FILES_CHANGED == 'true'
4142
run: make generate_mocks
4243
- uses: peter-evans/create-pull-request@v7
43-
if: steps.verify-changed-files.outputs.files_changed == 'true'
44+
if: env.FILES_CHANGED == 'true'
4445
with:
4546
token: ${{ secrets.APIX_BOT_PAT }}
4647
title: "APIBot: GO SDK Dev Preview"

.github/workflows/autoupdate-prod.yaml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,38 @@ jobs:
2929
export PATH=${PATH}:`go env GOPATH`/bin
3030
make clean_and_generate
3131
- name: Verify Changed files
32-
uses: tj-actions/verify-changed-files@4a3570896cbdc5dca56a7a259fba88667845e18a
33-
id: verify-changed-files
34-
with:
35-
files: |
36-
./admin/**/*
32+
run: |
33+
FILES_CHANGED=false
34+
if git diff --name-only | grep -qE '^admin/'; then
35+
FILES_CHANGED=true
36+
fi
37+
# also untracked files like new files
38+
if git ls-files --exclude-standard --others | grep -qE '^admin/'; then
39+
FILES_CHANGED=true
40+
fi
41+
echo "FILES_CHANGED=${FILES_CHANGED}" >> "$GITHUB_ENV"
3742
- name: Run docs generation
38-
if: steps.verify-changed-files.outputs.files_changed == 'true'
43+
if: env.FILES_CHANGED == 'true'
3944
run: make gen-docs
4045
- name: Commit Generator Changes
41-
if: steps.verify-changed-files.outputs.files_changed == 'true'
46+
if: env.FILES_CHANGED == 'true'
4247
run: |
4348
git add . && git commit -m "fix: Generated SDK source code and docs"
4449
- name: Release updates
45-
if: steps.verify-changed-files.outputs.files_changed == 'true'
50+
if: env.FILES_CHANGED == 'true'
4651
working-directory: ./tools
4752
run: make new-version
4853
- name: Ensure all markdown code is formatted
49-
if: steps.verify-changed-files.outputs.files_changed == 'true'
54+
if: env.FILES_CHANGED == 'true'
5055
working-directory: ./tools
5156
run: |
5257
npm install && npm run format
5358
- name: Run mock generation
5459
working-directory: ./tools
55-
if: steps.verify-changed-files.outputs.files_changed == 'true'
60+
if: env.FILES_CHANGED == 'true'
5661
run: make generate_mocks
5762
- uses: peter-evans/create-pull-request@v7
58-
if: steps.verify-changed-files.outputs.files_changed == 'true'
63+
if: env.FILES_CHANGED == 'true'
5964
with:
6065
token: ${{ secrets.APIX_BOT_PAT }}
6166
title: "APIBot: SDK update based on recent changes in Atlas API"

0 commit comments

Comments
 (0)