99jobs :
1010 lint :
1111 runs-on : ubuntu-latest
12+ if : >
13+ github.event_name == 'pull_request' ||
14+ (
15+ github.repository == 'PolicyEngine/policyengine-us-data'
16+ && github.event.head_commit.message == 'Update PolicyEngine US data'
17+ )
1218 name : Lint
1319 steps :
1420 - uses : actions/checkout@v4
2228 pip install black
2329 - name : Check formatting
2430 run : black . -l 79 --check
31+ check-version :
32+ name : Check version
33+ runs-on : ubuntu-latest
34+ if : >
35+ github.event_name == 'pull_request' ||
36+ (
37+ github.repository == 'PolicyEngine/policyengine-us-data'
38+ && github.event.head_commit.message != 'Update PolicyEngine US data'
39+ )
40+ steps :
41+ - name : Checkout code
42+ uses : actions/checkout@v4
43+ with :
44+ fetch-depth : 0 # Fetch all history for all tags and branches
45+ repository : ${{ github.event.pull_request.head.repo.full_name }}
46+ ref : ${{ github.event.pull_request.head.ref }}
47+ - name : Set up Python
48+ uses : actions/setup-python@v5
49+ with :
50+ python-version : 3.12
51+ - name : Build changelog
52+ run : pip install "yaml-changelog>=0.1.7" && make changelog
53+ - name : Preview changelog update
54+ run : " .github/get-changelog-diff.sh"
55+ - name : Check version number has been properly updated
56+ run : " .github/is-version-number-acceptable.sh"
57+ - name : Update changelog
58+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
59+ uses : EndBug/add-and-commit@v9
60+ with :
61+ add : " ."
62+ committer_name : Github Actions[bot]
63+ author_name : Github Actions[bot]
64+ message : Update PolicyEngine US data
65+ github_token : ${{ secrets.POLICYENGINE_GITHUB }}
2566 test :
2667 name : Build and test
2768 runs-on : ubuntu-latest
69+ if : >
70+ github.event_name == 'pull_request' ||
71+ (
72+ github.repository == 'PolicyEngine/policyengine-us-data'
73+ && github.event.head_commit.message == 'Update PolicyEngine US data'
74+ )
2875 steps :
2976 - name : Checkout code
3077 uses : actions/checkout@v4
5198 publish-to-pypi :
5299 name : Publish to PyPI
53100 runs-on : ubuntu-latest
54- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
101+ if : >
102+ github.repository == 'PolicyEngine/policyengine-us-data'
103+ && github.event.head_commit.message == 'Update PolicyEngine US data'
55104 steps :
56105 - name : Checkout code
57106 uses : actions/checkout@v4
76125 docker :
77126 name : Docker
78127 runs-on : ubuntu-latest
79- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
128+ if : >
129+ github.repository == 'PolicyEngine/policyengine-us-data'
130+ && github.event.head_commit.message == 'Update PolicyEngine US data'
80131 steps :
81132 - name : Checkout repo
82133 uses : actions/checkout@v4
93144 publish-docs :
94145 name : Publish documentation
95146 runs-on : ubuntu-latest
96- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
147+ if : >
148+ github.repository == 'PolicyEngine/policyengine-us-data'
149+ && github.event.head_commit.message == 'Update PolicyEngine US data'
97150 steps :
98151 - name : Checkout code
99152 uses : actions/checkout@v4
@@ -117,7 +170,9 @@ jobs:
117170 name : Upload data
118171 runs-on : ubuntu-latest
119172 needs : [lint, test]
120- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
173+ if : >
174+ github.repository == 'PolicyEngine/policyengine-us-data'
175+ && github.event.head_commit.message == 'Update PolicyEngine US data'
121176 steps :
122177 - name : Checkout code
123178 uses : actions/checkout@v4
0 commit comments