Skip to content

Commit 14639d6

Browse files
committed
Fix CodeQL alerts and add release Makefile (v1.3.1)
- Add permissions: contents: read to CI workflows (missing-workflow-permissions) - Tighten test assertions to avoid incomplete-url-substring-sanitization pattern - Bump version to 1.3.1 - Add Makefile with patch/minor/major release targets
1 parent bd18a10 commit 14639d6

5 files changed

Lines changed: 39 additions & 4 deletions

File tree

.github/workflows/dockerhub-readme.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
jobs:
1111
push-readme:
1212
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
1315
steps:
1416
- uses: actions/checkout@v6
1517

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
jobs:
88
test:
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
1012
steps:
1113
- uses: actions/checkout@v6
1214

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
CURRENT_VERSION := $(shell grep -m1 '__version__' py_conf_sync.py | cut -d'"' -f2)
2+
MAJOR := $(word 1,$(subst ., ,$(CURRENT_VERSION)))
3+
MINOR := $(word 2,$(subst ., ,$(CURRENT_VERSION)))
4+
PATCH := $(word 3,$(subst ., ,$(CURRENT_VERSION)))
5+
6+
.DEFAULT_GOAL := help
7+
8+
.PHONY: help patch minor major
9+
10+
help:
11+
@echo "Usage: make [patch|minor|major]"
12+
@echo " Current version: $(CURRENT_VERSION)"
13+
14+
patch:
15+
$(eval NEW_VERSION := $(MAJOR).$(MINOR).$(shell echo $$(($(PATCH)+1))))
16+
$(call _release,$(NEW_VERSION))
17+
18+
minor:
19+
$(eval NEW_VERSION := $(MAJOR).$(shell echo $$(($(MINOR)+1))).0)
20+
$(call _release,$(NEW_VERSION))
21+
22+
major:
23+
$(eval NEW_VERSION := $(shell echo $$(($(MAJOR)+1))).0.0)
24+
$(call _release,$(NEW_VERSION))
25+
26+
define _release
27+
sed -i 's/__version__ = "$(CURRENT_VERSION)"/__version__ = "$(1)"/' py_conf_sync.py
28+
git add py_conf_sync.py
29+
git commit -m "chore: bump version to $(1)"
30+
git tag v$(1)
31+
git push origin main --tags
32+
endef

py_conf_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from markdownify import markdownify as md
2727
from dotenv import load_dotenv
2828

29-
__version__ = "1.3.0"
29+
__version__ = "1.3.1"
3030

3131
# ---------------------------------------------------------------------------
3232
# Config helpers

tests/test_conversion.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,7 @@ def test_relative_link_without_title_uses_page_id_url(self, tmp_path):
683683
current = tmp_path / "docs" / "containerization.md"
684684
body = "[Auth Repo](ci/auth.md)"
685685
result = _resolve_relative_md_links(body, current, config)
686-
assert "111222" in result
687-
assert "confluence.example.com" in result
686+
assert result == "[Auth Repo](https://confluence.example.com/pages/111222)"
688687

689688
def test_relative_link_to_untracked_file_unchanged(self, tmp_path):
690689
config = self._config(tmp_path, [])
@@ -836,7 +835,7 @@ def test_skips_existing_without_force(self, tmp_path, monkeypatch, capsys):
836835
cmd_init(args)
837836
captured = capsys.readouterr()
838837
assert "skip" in captured.out
839-
assert "old.example.com" in config_path.read_text()
838+
assert config_path.read_text() == "confluence_url: https://old.example.com\n"
840839

841840
def test_overwrites_with_force(self, tmp_path, monkeypatch):
842841
monkeypatch.chdir(tmp_path)

0 commit comments

Comments
 (0)