Skip to content

Commit 8161e0c

Browse files
authored
Merge pull request #68 from PolicyEngine/fix/changelogging
Fix changelogging
2 parents 572b643 + fbce19a commit 8161e0c

4 files changed

Lines changed: 66 additions & 53 deletions

File tree

.github/workflows/pull_request.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# This workflow is used to check various parts of the
2+
# run prior to merging:
3+
4+
# - The code's formatting
5+
# - Versioning - note that this checks, but does not update
6+
# - That the code builds successfully
7+
# - That any automated tests pass
18
name: Pull request
29

310
on:

.github/workflows/push_1.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This builds and pushes the changelog, then
2+
# automatically runs push_2 using the new version number
3+
# to allow for proper pushing to PyPI.
4+
5+
# This script must run first and complete to allow for
6+
# proper versioning.
7+
8+
name: Push 1
9+
10+
on:
11+
push:
12+
branches: [main]
13+
14+
jobs:
15+
check-version:
16+
name: Check version
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Fetch all history for all tags and branches
23+
repository: ${{ github.event.pull_request.head.repo.full_name }}
24+
ref: ${{ github.event.pull_request.head.ref }}
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: 3.12
29+
- name: Build changelog
30+
run: pip install "yaml-changelog>=0.1.7" && make changelog
31+
- name: Preview changelog update
32+
run: ".github/get-changelog-diff.sh"
33+
- name: Check version number has been properly updated
34+
run: ".github/is-version-number-acceptable.sh"
35+
- name: Update changelog
36+
uses: EndBug/add-and-commit@v9
37+
with:
38+
add: "."
39+
committer_name: Github Actions[bot]
40+
author_name: Github Actions[bot]
41+
message: Update PolicyEngine US data
42+
github_token: ${{ secrets.POLICYENGINE_US_DATA_GITHUB_TOKEN }}
Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: Push
1+
# After successful versioning, this script runs various
2+
# parts of the push process
3+
name: Push 2
24

35
on:
4-
push:
5-
branches: [main]
6-
workflow_dispatch:
6+
workflow_run:
7+
workflows: ["Push 1"]
8+
types: [completed]
79

810
jobs:
911
lint:
1012
runs-on: ubuntu-latest
11-
if: |
12-
(github.repository == 'PolicyEngine/policyengine-us-data')
13-
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
13+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1414
name: Lint
1515
steps:
1616
- uses: actions/checkout@v4
@@ -24,43 +24,10 @@ jobs:
2424
pip install black
2525
- name: Check formatting
2626
run: black . -l 79 --check
27-
check-version:
28-
name: Check version
29-
runs-on: ubuntu-latest
30-
if: |
31-
(github.repository == 'PolicyEngine/policyengine-us-data')
32-
&& !(github.event.head_commit.message == 'Update PolicyEngine US data')
33-
steps:
34-
- name: Checkout code
35-
uses: actions/checkout@v4
36-
with:
37-
fetch-depth: 0 # Fetch all history for all tags and branches
38-
repository: ${{ github.event.pull_request.head.repo.full_name }}
39-
ref: ${{ github.event.pull_request.head.ref }}
40-
- name: Set up Python
41-
uses: actions/setup-python@v5
42-
with:
43-
python-version: 3.12
44-
- name: Build changelog
45-
run: pip install "yaml-changelog>=0.1.7" && make changelog
46-
- name: Preview changelog update
47-
run: ".github/get-changelog-diff.sh"
48-
- name: Check version number has been properly updated
49-
run: ".github/is-version-number-acceptable.sh"
50-
- name: Update changelog
51-
uses: EndBug/add-and-commit@v9
52-
with:
53-
add: "."
54-
committer_name: Github Actions[bot]
55-
author_name: Github Actions[bot]
56-
message: Update PolicyEngine US data
57-
github_token: ${{ secrets.POLICYENGINE_GITHUB }}
5827
test:
5928
name: Build and test
6029
runs-on: ubuntu-latest
61-
if: |
62-
(github.repository == 'PolicyEngine/policyengine-us-data')
63-
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
30+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
6431
steps:
6532
- name: Checkout code
6633
uses: actions/checkout@v4
@@ -87,9 +54,7 @@ jobs:
8754
publish-to-pypi:
8855
name: Publish to PyPI
8956
runs-on: ubuntu-latest
90-
if: |
91-
(github.repository == 'PolicyEngine/policyengine-us-data')
92-
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
57+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
9358
steps:
9459
- name: Checkout code
9560
uses: actions/checkout@v4
@@ -114,9 +79,7 @@ jobs:
11479
docker:
11580
name: Docker
11681
runs-on: ubuntu-latest
117-
if: |
118-
(github.repository == 'PolicyEngine/policyengine-us-data')
119-
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
82+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12083
steps:
12184
- name: Checkout repo
12285
uses: actions/checkout@v4
@@ -133,9 +96,7 @@ jobs:
13396
publish-docs:
13497
name: Publish documentation
13598
runs-on: ubuntu-latest
136-
if: |
137-
(github.repository == 'PolicyEngine/policyengine-us-data')
138-
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
99+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
139100
steps:
140101
- name: Checkout code
141102
uses: actions/checkout@v4
@@ -159,9 +120,7 @@ jobs:
159120
name: Upload data
160121
runs-on: ubuntu-latest
161122
needs: [lint, test]
162-
if: |
163-
(github.repository == 'PolicyEngine/policyengine-us-data')
164-
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
123+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
165124
steps:
166125
- name: Checkout code
167126
uses: actions/checkout@v4

changelog_entry.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- bump: patch
2+
changes:
3+
changed:
4+
- Split push actions into two separate files
5+
- Made run of second portion of push conditional upon run of first

0 commit comments

Comments
 (0)