Skip to content

Commit 1292afa

Browse files
authored
Merge 2216253 into 777fdaa
2 parents 777fdaa + 2216253 commit 1292afa

File tree

12 files changed

+76
-152
lines changed

12 files changed

+76
-152
lines changed

.github/utils/requirements_ci.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pre-commit ~=4.5

.github/utils/update_version.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@ echo -e "\n### Setting commit user ###"
55
git config --global user.email "${GIT_USER_EMAIL}"
66
git config --global user.name "${GIT_USER_NAME}"
77

8-
echo -e "\n### Update version in README ###"
9-
invoke update-version --version="${GITHUB_REF#refs/tags/}"
8+
ref=${GITHUB_REF#refs/tags/}
9+
10+
echo -e "\n### Update version to ${ref} ###"
11+
invoke update-version --version="${ref}"
1012

1113
echo -e "\n### Commit update ###"
1214
git add push_action/__init__.py
1315
git add CHANGELOG.md
14-
git commit -m "Release ${GITHUB_REF#refs/tags/}"
16+
git commit -m "Release ${ref}"
1517

1618
echo -e "\n### Create new full version (v<MAJOR>.<MINOR>.<PATCH>) tag ###"
1719
TAG_MSG=.github/utils/release_tag_msg.txt
18-
sed -i "s|TAG_NAME|${GITHUB_REF#refs/tags/}|g" "${TAG_MSG}"
20+
sed -i "s|TAG_NAME|${ref}|g" "${TAG_MSG}"
1921

20-
git tag -af -F "${TAG_MSG}" ${GITHUB_REF#refs/tags/}
22+
git tag -af -F "${TAG_MSG}" ${ref}
2123

2224
echo -e "\n### Move/update v<MAJOR> tag ###"
2325
MAJOR_VERSION=$( echo ${GITHUB_REF#refs/tags/v} | cut -d "." -f 1 )

.github/workflows/cd_release.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
PUBLISH_UPDATE_BRANCH: main
1010
GIT_USER_NAME: CasperWA
1111
GIT_USER_EMAIL: "casper+github@welzel.nu"
12+
EXCLUDE_TAGS_REGEX: "^(ci_test|master|v[0-9]+)$"
1213

1314
jobs:
1415
update-repo-and-release:
@@ -18,27 +19,26 @@ jobs:
1819

1920
steps:
2021
- name: Checkout repository
21-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
2223
with:
2324
fetch-depth: 0
2425

25-
- name: Set up Python 3.11
26-
uses: actions/setup-python@v5
26+
- name: Set up Python 3.12
27+
uses: actions/setup-python@v6
2728
with:
28-
python-version: '3.11'
29+
python-version: '3.12'
2930

3031
- name: Install Python dependencies
3132
run: |
3233
python -m pip install -U pip
3334
pip install -U setuptools wheel
34-
pip install -U -e .[dev]
35+
pip install .[dev]
36+
pip install flit
3537
3638
- name: Update changelog
37-
uses: CharMixer/auto-changelog-action@v1
39+
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
3840
with:
39-
token: ${{ secrets.GITHUB_TOKEN }}
40-
release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
41-
exclude_tags_regex: "^(ci_test|master|v[0-9]+)$"
41+
args: --user "CasperWA" --project push-protected --token "${{ secrets.GITHUB_TOKEN }}" --release-branch "${{ env.PUBLISH_UPDATE_BRANCH }}" --exclude-tags-regex "${{ env.EXCLUDE_TAGS_REGEX }}"
4242

4343
- name: Update version and tags
4444
run: .github/utils/update_version.sh
@@ -54,16 +54,16 @@ jobs:
5454
tags: true
5555

5656
- name: Get tagged versions
57-
run: echo "PREVIOUS_VERSION=$(git tag -l --sort -version:refname | sed -n 2p)" >> $GITHUB_ENV
57+
id: tagged_versions
58+
run: |
59+
PREVIOUS_VERSION="$(git tag -l --sort -version:refname | grep -v -e "${{ env.EXCLUDE_TAGS_REGEX }}" | sed -n 2p)"
60+
61+
echo "since_previous_version=--since-tag=${PREVIOUS_VERSION}" >> $GITHUB_OUTPUT
5862
5963
- name: Create release-specific changelog
60-
uses: CharMixer/auto-changelog-action@v1
64+
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
6165
with:
62-
token: ${{ secrets.GITHUB_TOKEN }}
63-
release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }}
64-
since_tag: "${{ env.PREVIOUS_VERSION }}"
65-
output: "release_changelog.md"
66-
exclude_tags_regex: "^(ci_test|master|v[0-9]+)$"
66+
args: --user "CasperWA" --project push-protected --token "${{ secrets.GITHUB_TOKEN }}" --release-branch "${{ env.PUBLISH_UPDATE_BRANCH }}" ${{ steps.tagged_versions.outputs.since_previous_version }} --output release_changelog.md --usernames-as-github-logins --exclude-tags-regex "${{ env.EXCLUDE_TAGS_REGEX }}"
6767

6868
- name: Append changelog to release body
6969
run: |

.github/workflows/ci_dependabot.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,16 @@ jobs:
2323
with:
2424
ref: main
2525

26-
- name: Set up Python 3.11
26+
- name: Set up Python 3.12
2727
uses: actions/setup-python@v5
2828
with:
29-
python-version: '3.11'
29+
python-version: '3.12'
3030

3131
- name: Install `pre-commit`
3232
run: |
3333
python -m pip install -U pip
3434
pip install -U setuptools wheel
35-
36-
while IFS="" read -r line || [ -n "${line}" ]; do
37-
if [[ "${line}" =~ ^pre-commit.*$ ]]; then
38-
pre_commit="${line}"
39-
fi
40-
done < requirements_dev.txt
41-
42-
pip install ${pre_commit}
35+
pip install -r .github/utils/requirements_ci.txt
4336
4437
- name: Set up git user info
4538
run: |

.github/workflows/ci_tests.yml

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
token: ${{ secrets.CI_RESET_TEST_BRANCHES }}
2121
fetch-depth: 0
2222

23-
- name: Set up Python 3.11
23+
- name: Set up Python 3.12
2424
uses: actions/setup-python@v5
2525
with:
26-
python-version: '3.11'
26+
python-version: '3.12'
2727

2828
- name: Reset branches
2929
run: |
@@ -292,54 +292,16 @@ jobs:
292292
- name: Checkout repository
293293
uses: actions/checkout@v4
294294

295-
- name: Set up Python 3.11
295+
- name: Set up Python 3.12
296296
uses: actions/setup-python@v5
297297
with:
298-
python-version: '3.11'
298+
python-version: '3.12'
299299

300300
- name: Install dependencies
301301
run: |
302302
python -m pip install --upgrade pip
303303
pip install -U setuptools wheel
304-
305-
while IFS="" read -r line || [ -n "${line}" ]; do
306-
if [[ "${line}" =~ ^pre-commit.*$ ]]; then
307-
pre_commit="${line}"
308-
fi
309-
done < requirements_dev.txt
310-
311-
pip install ${pre_commit}
304+
pip install -r .github/utils/requirements_ci.txt
312305
313306
- name: Test with pre-commit
314-
run: SKIP=pylint pre-commit run --all-files --show-diff-on-failure
315-
316-
pylint-safety:
317-
runs-on: ubuntu-latest
318-
319-
steps:
320-
- name: Checkout repository
321-
uses: actions/checkout@v4
322-
with:
323-
fetch-depth: 2
324-
325-
- name: Set up Python 3.11
326-
uses: actions/setup-python@v5
327-
with:
328-
python-version: '3.11'
329-
330-
- name: Install dependencies
331-
run: |
332-
python -m pip install -U pip
333-
pip install -U setuptools wheel
334-
pip install -U -r requirements.txt -r requirements_dev.txt
335-
pip install safety
336-
337-
- name: Run pylint
338-
run: pylint --rcfile=pyproject.toml *.py push_action
339-
340-
# ID: 70612
341-
# Package: Jinja2
342-
# Has been disputed by the maintainer and multiple third parties.
343-
# For more information see: https://github.com/advisories/GHSA-f6pv-j8mr-w6rr
344-
- name: Run safety
345-
run: pip freeze | safety check --stdin --ignore=70612
307+
run: pre-commit run --all-files --show-diff-on-failure

.pre-commit-config.yaml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_language_version:
2-
python: python3.11
2+
python: python3.12
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -20,7 +20,7 @@ repos:
2020
rev: v3.20.0
2121
hooks:
2222
- id: pyupgrade
23-
args: [--py311-plus]
23+
args: [--py312-plus]
2424

2525
- repo: https://github.com/ambv/black
2626
rev: 25.1.0
@@ -41,13 +41,3 @@ repos:
4141
additional_dependencies:
4242
- "types-requests"
4343
- "types-simplejson"
44-
45-
- repo: local
46-
hooks:
47-
- id: pylint
48-
name: pylint
49-
entry: pylint
50-
language: python
51-
types: [python]
52-
require_serial: true
53-
exclude: ^tests/.*$

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM python:3.11-alpine
1+
FROM python:3.12-alpine
22

3-
COPY README.md setup.py requirements*.txt ./
3+
COPY LICENSE README.md pyproject.toml ./
44
COPY push_action ./push_action
55

66
RUN apk update \

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-2021 Casper Welzel Andersen
3+
Copyright (c) 2020-2025 Casper Welzel Andersen
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

pyproject.toml

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,44 @@
1+
[build-system]
2+
requires = ["flit-core>=3.11,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[project]
6+
name="push-action"
7+
dynamic = ["version"]
8+
authors = [{name = "Casper Welzel Andersen", email = "casper+github@welzel.nu"}]
9+
description = "Push local workflow commit(s) to protected branches with required status checks."
10+
readme = "README.md"
11+
license = {file = "LICENSE"}
12+
classifiers = [
13+
"Programming Language :: Python :: 3.12",
14+
"License :: OSI Approved :: MIT License",
15+
"Operating System :: OS Independent",
16+
"Development Status :: 5 - Production/Stable",
17+
"Intended Audience :: Developers",
18+
]
19+
requires-python = ">=3.12,<3.13"
20+
21+
dependencies = [
22+
"requests ~=2.32",
23+
]
24+
25+
[project.optional-dependencies]
26+
dev = [
27+
"invoke ~=2.2",
28+
"pre-commit ~=4.2",
29+
"pylint ~=3.3",
30+
]
31+
32+
[project.scripts]
33+
push-action = "push_action.run:main"
34+
35+
[tool.flit.module]
36+
name = "push_action"
37+
138
[tool.mypy]
2-
python_version = "3.11"
39+
python_version = "3.12"
340
ignore_missing_imports = true
441
scripts_are_modules = true
542
warn_unused_configs = true
643
show_error_codes = true
744
allow_redefinition = true
8-
9-
[tool.pylint.messages_control]
10-
max-line-length = 90
11-
disable = [
12-
# "duplicate-code",
13-
# "no-name-in-module"
14-
]

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)