Skip to content

Commit 717ec81

Browse files
authored
Update GitHub workflows (#51)
* Make CHANGELOG release names more consistent * Run mdformat-gfm on CHANGELOG * Add GitHub workflow to handle pre-commit.ci updates automatically * Minor cleanup for CHANGELOG
1 parent 36fa1f1 commit 717ec81

File tree

3 files changed

+139
-114
lines changed

3 files changed

+139
-114
lines changed

.github/workflows/draft_release.yml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
name: "Draft new release"
44

5-
on:
5+
on: # yamllint disable-line rule:truthy
66
workflow_dispatch:
77
inputs:
8-
version:
9-
description: 'Version to release'
8+
tag:
9+
description: 'Version to release (format: vXX.YY.ZZ)'
1010
required: true
1111

1212
jobs:
@@ -16,43 +16,41 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v3
1818

19-
- name: Create release branch
20-
run: |
21-
git checkout -b release/${{ github.event.inputs.version }}
22-
23-
- name: Update changelog
24-
uses: thomaseizinger/keep-a-changelog-new-release@1.3.0
19+
- name: Setup Python
20+
uses: actions/setup-python@v3
2521
with:
26-
version: ${{ github.event.inputs.version }}
22+
python-version: '3.11'
23+
cache: 'pip'
24+
cache-dependency-path: '**/setup.cfg'
2725

28-
- name: Initialize mandatory git config
26+
- name: Update CHANGELOG
2927
run: |
30-
git config user.name "GitHub actions"
31-
git config user.email noreply@github.com
32-
- name: Commit changelog and manifest files
28+
python3 -m pip install mdformat-gfm 'git+https://github.com/Takishima/keepachangelog@v1.0.1'
29+
python3 -m keepachangelog release "${{ github.event.inputs.tag }}"
30+
python3 -m mdformat CHANGELOG.md
31+
32+
- name: Commit changes
33+
uses: stefanzweifel/git-auto-commit-action@v4
3334
id: make-commit
34-
run: |
35-
git add CHANGELOG.md
36-
git commit --message "Preparing release v${{ github.event.inputs.version }}"
37-
echo "::set-output name=commit::$(git rev-parse HEAD)"
38-
- name: Push new branch
39-
run: git push origin release/${{ github.event.inputs.version }}
35+
with:
36+
branch: release/${{ github.event.inputs.tag }}
37+
create_branch: true
38+
file_pattern: 'CHANGELOG.md'
39+
commit_message: Preparing release ${{ github.event.inputs.tag }}
40+
commit_author: github-actions[bot] <noreply@github.com>
4041

4142
# yamllint disable rule:line-length
4243
- name: Create pull request
4344
uses: thomaseizinger/create-pull-request@1.3.0
4445
env:
4546
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4647
with:
47-
head: release/${{ github.event.inputs.version }}
48+
head: release/${{ github.event.inputs.tag }}
4849
base: main
49-
title: Release version ${{ github.event.inputs.version }}
50+
title: Release version ${{ github.event.inputs.tag }}
5051
reviewers: ${{ github.actor }}
51-
# Write a nice message to the user.
52-
# We are claiming things here based on the `publish-new-release.yml` workflow.
53-
# You should obviously adopt it to say the truth depending on your release workflow :)
5452
body: |
5553
Hi @${{ github.actor }}!
5654
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}.
57-
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}.
55+
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit_hash }}.
5856
Merging this PR will create a GitHub release and upload any assets that are created as part of the release build.

.github/workflows/pre-commit-ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
3+
name: Pre-commit CHANGELOG autoupdate
4+
5+
on: # yamllint disable-line rule:truthy
6+
pull_request:
7+
types:
8+
- opened
9+
- reopened
10+
11+
jobs:
12+
update-changelog:
13+
runs-on: ubuntu-latest
14+
name: "Pre-commit CI CHANGELOG auto-update"
15+
if: github.event.pull_request.title == '[pre-commit.ci] pre-commit autoupdate'
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: '3.11'
23+
cache: 'pip'
24+
cache-dependency-path: '**/setup.cfg'
25+
26+
- name: Install dependencies
27+
run: |
28+
python3 -m pip install 'git+https://github.com/Takishima/pre-commit-changelog-auto-update@v1.0.0'
29+
30+
- name: Run Python script
31+
run: |
32+
python3 -m update_changelog --pr-body "${{ github.event.pull_request.body }}"
33+
34+
- name: Commit changes
35+
uses: stefanzweifel/git-auto-commit-action@v4
36+
with:
37+
commit_message: Update CHANGELOG
38+
commit_author: github-actions[bot] <noreply@github.com>

CHANGELOG.md

Lines changed: 77 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -9,149 +9,138 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Changed
1111

12-
- Changed minimum Python version to 3.8.X
13-
14-
### Updated
15-
16-
- Update GitHub release publishing workflow
17-
- Replace most Python pre-commit hooks with [ruff](https://beta.ruff.rs/docs/)
18-
- Added some more pre-commit hooks:
19-
+ doc8
20-
+ codespell
21-
+ yamllint
22-
+ blacken-docs
23-
+ pyupgrade
12+
- Changed minimum Python version to 3.8.X
2413

2514
### Repository
2615

27-
- Update `thomaseizinger/create-pull-request` GitHub Action to v1.3.0
28-
- Update `Lucas-C/pre-commit-hooks` hook to v1.5.1
29-
- Update `black` hook to v23.3.0
30-
- Update `blacken-docs` hook to v1.13.0
31-
- Update `pre-commit/pre-commit-hooks` to v4.3.0
32-
- Update `yamllint` hook to v1.32.0
33-
- Update `codespell` hook to v2.2.4
34-
35-
## [1.4.1] - 2022-05-04
16+
- Replace most Python pre-commit hooks with [ruff](https://beta.ruff.rs/docs/)
17+
- Update release drafting GitHub workflow
18+
- Add workflow to automatically update CHANGELOG when pre-commit.ci updates happen
19+
- Added some more pre-commit hooks:
20+
- doc8
21+
- codespell
22+
- yamllint
23+
- blacken-docs
24+
- Update `thomaseizinger/create-pull-request` GitHub Action to v1.3.0
25+
- Update `Lucas-C/pre-commit-hooks` hook to v1.5.1
26+
- Update `black` hook to v23.3.0
27+
- Update `blacken-docs` hook to v1.13.0
28+
- Update `pre-commit/pre-commit-hooks` to v4.3.0
29+
- Update `yamllint` hook to v1.32.0
30+
- Update `codespell` hook to v2.2.4
31+
32+
## [v1.4.1] - 2022-05-04
3633

3734
### Fixed
3835

39-
- Fixed uses of of `pylint.testutils.MessageTest` instead of `pylint.testutils.Message` for Pylint >= 2.12
40-
- Fixed failing tests due to missing `ignore_position` argument to `assertAddsMessages()`
36+
- Fixed uses of of `pylint.testutils.MessageTest` instead of `pylint.testutils.Message` for Pylint >= 2.12
37+
- Fixed failing tests due to missing `ignore_position` argument to `assertAddsMessages()`
4138

4239
### Repository
4340

44-
- Update `black` hook to v22.3.0
45-
- Update `check-manifest` hook to v0.48
46-
- Update `isort` hook to v5.10.1
47-
- Update `flake8` hook to v4.0.1
48-
- Update `pre-commit/pre-commit-hooks` to v4.2.0
49-
- Update `Lucas-C/pre-commit-hooks` hook to v1.2.0
50-
- Update `dangoslen/changelog-enforcer` GitHub action to v3
51-
- Update `thomaseizinger/create-pull-request` GitHub action to v1.2.2
52-
- Update `thomaseizinger/keep-a-changelog-new-release` GitHub action to v1.3.0
53-
- Update GitHub's CodeQL action to v2
54-
- Update parse-changelog version to v0.4.7
55-
- Fixed issue with release publishing GitHub workflow
56-
57-
## [1.4.0] - 2021-07-29
41+
- Update `black` hook to v22.3.0
42+
- Update `check-manifest` hook to v0.48
43+
- Update `isort` hook to v5.10.1
44+
- Update `flake8` hook to v4.0.1
45+
- Update `pre-commit/pre-commit-hooks` to v4.2.0
46+
- Update `Lucas-C/pre-commit-hooks` hook to v1.2.0
47+
- Update `dangoslen/changelog-enforcer` GitHub action to v3
48+
- Update `thomaseizinger/create-pull-request` GitHub action to v1.2.2
49+
- Update `thomaseizinger/keep-a-changelog-new-release` GitHub action to v1.3.0
50+
- Update GitHub's CodeQL action to v2
51+
- Update parse-changelog version to v0.4.7
52+
- Fixed issue with release publishing GitHub workflow
53+
54+
## [v1.4.0] - 2021-07-29
5855

5956
### Added
6057

61-
- Added W8016 to warn when using `os.mkdir` and `os.makedir` with unsafe permissions (UNIX-only)
62-
- Added W8017 to warn when using `os.mkfifo` with unsafe permissions (UNIX-only)
63-
- Added W8018 to warn when using `os.mknod` with unsafe permissions (UNIX-only)
64-
- Added W8019 to warn when using `os.chmod` with unsafe permissions (all except Windows)
58+
- Added W8016 to warn when using `os.mkdir` and `os.makedir` with unsafe permissions (UNIX-only)
59+
- Added W8017 to warn when using `os.mkfifo` with unsafe permissions (UNIX-only)
60+
- Added W8018 to warn when using `os.mknod` with unsafe permissions (UNIX-only)
61+
- Added W8019 to warn when using `os.chmod` with unsafe permissions (all except Windows)
6562

6663
### Updated
6764

68-
- Refactor configuration option parsing for mode-like options
65+
- Refactor configuration option parsing for mode-like options
6966

7067
### Fixed
7168

72-
- Critical typo for `msgs` attribute of the plugin class. This effectively rendered any previous version useless as
73-
pylint would not recognize the warning/error messages
69+
- Critical typo for `msgs` attribute of the plugin class. This effectively rendered any previous version useless as
70+
pylint would not recognize the warning/error messages
7471

7572
### Repository
7673

77-
- Restrict running some GitHub actions when a pull request is merged
74+
- Restrict running some GitHub actions when a pull request is merged
7875

79-
## [1.3.1] - 2021-07-27
76+
## [v1.3.1] - 2021-07-27
8077

8178
### Updated
8279

83-
- Update unit tests for `os.open()`
80+
- Update unit tests for `os.open()`
8481

8582
### Fixed
8683

87-
- Fix issue when processing keyword arguments for `os.open()`
84+
- Fix issue when processing keyword arguments for `os.open()`
8885

8986
### Repository
9087

91-
- Restrict running some GitHub actions only when pull requests are updated
88+
- Restrict running some GitHub actions only when pull requests are updated
9289

93-
## [1.3.0] - 2021-07-26
90+
## [v1.3.0] - 2021-07-26
9491

9592
### Added
9693

97-
- Add plugin option to control whether we favour `os.open` over the builtin `open`
98-
- Added W8012 to warn when using `os.open` with unsafe permissions
99-
- Added E8013 to avoid using `pickle.load` and `pickle.loads`
100-
- Added E8014 to avoid using `marshal.load` and `marshal.loads`
101-
- Added E8015 to avoid using `shelve.open`
94+
- Add plugin option to control whether we favour `os.open` over the builtin `open`
95+
- Added W8012 to warn when using `os.open` with unsafe permissions
96+
- Added E8013 to avoid using `pickle.load` and `pickle.loads`
97+
- Added E8014 to avoid using `marshal.load` and `marshal.loads`
98+
- Added E8015 to avoid using `shelve.open`
10299

103100
### Fixed
104101

105-
- Fixed a few test function names
102+
- Fixed a few test function names
106103

107104
### Repository
108105

109-
- Update pre-commit hooks
110-
- Update `thomaseizinger/create-pull-request` GiHub action
106+
- Update pre-commit hooks
107+
- Update `thomaseizinger/create-pull-request` GiHub action
111108

112-
## [1.2.1] - 2021-07-19
109+
## [v1.2.1] - 2021-07-19
113110

114-
- Reworded E8003 and extend it to include a few more cases:
115-
- `subprocess.getoutput()`
116-
- `subprocess.getstatusoutput()`
117-
- `asyncio.create_subprocess_shell()`
118-
- `loop.subprocess_shell()`
111+
- Reworded E8003 and extend it to include a few more cases:
112+
- `subprocess.getoutput()`
113+
- `subprocess.getstatusoutput()`
114+
- `asyncio.create_subprocess_shell()`
115+
- `loop.subprocess_shell()`
119116

120-
## [1.2.0] - 2021-07-19
117+
## [v1.2.0] - 2021-07-19
121118

122119
### Added
123120

124-
- Added E8010 to avoid using `os.popen()` as it internally uses `subprocess.Popen` with `shell=True`
125-
- Added E8011 to avoid using `shlex.quote()` on non-POSIX platforms.
121+
- Added E8010 to avoid using `os.popen()` as it internally uses `subprocess.Popen` with `shell=True`
122+
- Added E8011 to avoid using `shlex.quote()` on non-POSIX platforms.
126123

127-
## [1.1.0] - 2021-07-02
124+
## [v1.1.0] - 2021-07-02
128125

129126
### Added
130127

131-
- Added R8009 to prefer `os.open()` to the builtin `open` when in writing mode
128+
- Added R8009 to prefer `os.open()` to the builtin `open` when in writing mode
132129

133130
### Repository
134131

135-
- Update pre-commit configuration
132+
- Update pre-commit configuration
136133

137-
## [1.0.0] - 2021-06-21
134+
## [v1.0.0] - 2021-06-21
138135

139136
Initial release
140137

141-
[Unreleased]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.4.1...HEAD
142-
143-
[1.4.1]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.4.0...v1.4.1
144-
145-
[1.4.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.3.1...v1.4.0
146-
147-
[1.3.1]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.3.0...v1.3.1
148-
149-
[1.3.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.2.1...v1.3.0
150-
151-
[1.2.1]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.2.0...v1.2.1
152-
153-
[1.2.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.1.0...v1.2.0
154-
155-
[1.1.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.0.0...v1.1.0
156-
157-
[1.0.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/375145a3dec096ff4e33901ef749a1a9a6f4edc6...v1.0.0
138+
[unreleased]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.4.1...HEAD
139+
[v1.0.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/375145a3dec096ff4e33901ef749a1a9a6f4edc6...v1.0.0
140+
[v1.1.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.0.0...v1.1.0
141+
[v1.2.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.1.0...v1.2.0
142+
[v1.2.1]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.2.0...v1.2.1
143+
[v1.3.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.2.1...v1.3.0
144+
[v1.3.1]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.3.0...v1.3.1
145+
[v1.4.0]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.3.1...v1.4.0
146+
[v1.4.1]: https://github.com/Takishima/pylint-secure-coding-standard/compare/v1.4.0...v1.4.1

0 commit comments

Comments
 (0)