-
Notifications
You must be signed in to change notification settings - Fork 11
66 lines (60 loc) · 2.49 KB
/
Copy pathfixture-update-reminder.yml
File metadata and controls
66 lines (60 loc) · 2.49 KB
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
name: Fixture update reminder
on:
pull_request:
paths:
- 'benefits/*/migrations/**'
jobs:
# Check which files have changed
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
migrations: ${{ steps.filter.outputs.migrations }}
fixtures: ${{ steps.filter.outputs.fixtures }}
steps:
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
migrations:
- 'benefits/*/migrations/*.py'
fixtures:
- 'benefits/*/migrations/local_fixtures.json'
# Remind author to confirm whether a fixture update is needed after adding a migration
migration_added_without_fixtures_update:
needs: changes
if: ${{ needs.changes.outputs.migrations == 'true' && needs.changes.outputs.fixtures == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Find existing comment
uses: peter-evans/find-comment@v4
id: find-comment
with:
issue-number: ${{ github.event.number }}
comment-author: github-actions[bot]
body-includes: Is a corresponding fixture update needed?
- name: Add new comment if one doesn't exist
if: steps.find-comment.outputs.comment-id == ''
run: gh pr comment $PR --body 'This PR adds a Django migration without updating any fixtures. Is a corresponding fixture update needed?'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.html_url }}
# Remind author to update shared fixtures and publicize it after merging
fixtures_updated:
needs: changes
if: ${{ needs.changes.outputs.fixtures == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Find existing comment
uses: peter-evans/find-comment@v4
id: find-comment
with:
issue-number: ${{ github.event.number }}
comment-author: github-actions[bot]
body-includes: make a corresponding update to the fixtures with secrets
- name: Add new comment if one doesn't exist
if: steps.find-comment.outputs.comment-id == ''
run: gh pr comment $PR --body 'This PR updates `local_fixtures.json`. After merging, please be sure to make a corresponding update to the fixtures with secrets in our shared LastPass folder and let other developers know that they should update their local fixtures accordingly.'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.html_url }}