mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-10-26 15:54:17 +00:00
Apply remaining PR 2933 review fixes
This commit is contained in:
1 parent
b68b44c991
commit
b1d8dad9da
1 file changed
+112
@@ -16,6 +16,118 @@ permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
address-pr2933-comments:
|
||||
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.number == 2933 && github.event.pull_request.head.repo.full_name == github.repository }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout PR head
|
||||
uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Apply remaining reviewed fixes
|
||||
shell: bash
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
|
||||
def replace(path: str, old: str, new: str, expected: int | None = 1) -> None:
|
||||
file = Path(path)
|
||||
text = file.read_text()
|
||||
count = text.count(old)
|
||||
if count:
|
||||
if expected is not None and count != expected:
|
||||
raise SystemExit(f"{path}: expected {expected} occurrence(s), found {count}: {old!r}")
|
||||
file.write_text(text.replace(old, new))
|
||||
return
|
||||
if new not in text:
|
||||
raise SystemExit(f"{path}: neither old nor new text found: {old!r}")
|
||||
|
||||
replace(
|
||||
"calibre/CHANGELOG.md",
|
||||
"This avoids the addon to mess with your homeassistant configuration folder",
|
||||
"This prevents the add-on from modifying your Home Assistant configuration folder",
|
||||
)
|
||||
replace(
|
||||
"calibre/CHANGELOG.md",
|
||||
"For more information, see here : https://developers.home-assistant.io/blog/2023/11/06/public-addon-config/ https://github.com/alexbelgium/hassio-addons/issues/1154",
|
||||
"For more information, see [the Home Assistant documentation](https://developers.home-assistant.io/blog/2023/11/06/public-addon-config/) and [issue #1154](https://github.com/alexbelgium/hassio-addons/issues/1154).",
|
||||
)
|
||||
replace(
|
||||
"filebrowser/CHANGELOG.md",
|
||||
"Files are now located in the addon config file, that can be accessed from the app_configs folder from my filebrowser or cloudcommander addons.",
|
||||
"Files are now located in the add-on config folder, which was exposed through the legacy /addon_configs path in the Filebrowser and Cloud Commander add-ons.",
|
||||
)
|
||||
replace(
|
||||
"filebrowser/CHANGELOG.md",
|
||||
"Homeassistant config accessible in /homeassistant folder ; all addons config in /addons_config ; this addon config in /config",
|
||||
"Home Assistant config accessible in /homeassistant; all add-on config in the legacy /addon_configs path; this add-on config in /config",
|
||||
)
|
||||
|
||||
for path in (
|
||||
"fireflyiii_data_importer/CHANGELOG.md",
|
||||
"guacamole/CHANGELOG.md",
|
||||
"photoprism/CHANGELOG.md",
|
||||
"radarr/CHANGELOG.md",
|
||||
"requestrr/CHANGELOG.md",
|
||||
"unpackerr/CHANGELOG.md",
|
||||
):
|
||||
replace(
|
||||
path,
|
||||
"This avoids the addon to mess with your homeassistant configuration folder",
|
||||
"This prevents the add-on from modifying your Home Assistant configuration folder",
|
||||
)
|
||||
|
||||
mealie = Path("mealie/CHANGELOG.md")
|
||||
mealie_text = mealie.read_text()
|
||||
old_mealie_path = "/app_configs/db21ed7f_mealie"
|
||||
new_mealie_path = "/addon_configs/db21ed7f_mealie"
|
||||
old_count = mealie_text.count(old_mealie_path)
|
||||
if old_count:
|
||||
if old_count != 4:
|
||||
raise SystemExit(f"mealie/CHANGELOG.md: expected 4 historical paths, found {old_count}")
|
||||
mealie_text = mealie_text.replace(old_mealie_path, new_mealie_path)
|
||||
elif mealie_text.count(new_mealie_path) < 4:
|
||||
raise SystemExit("mealie/CHANGELOG.md: historical path correction not found")
|
||||
mealie_text = mealie_text.replace("backuped", "backed up").replace("occured", "occurred")
|
||||
mealie.write_text(mealie_text)
|
||||
|
||||
replace(
|
||||
"unpackerr/CHANGELOG.md",
|
||||
"Any modifications needs to be done manually",
|
||||
"Any modifications need to be done manually",
|
||||
)
|
||||
replace(
|
||||
"whoogle/CHANGELOG.md",
|
||||
"all Mealie data to be backuped with the addon",
|
||||
"all Whoogle data to be backed up with the add-on",
|
||||
)
|
||||
replace(
|
||||
"webtrees/README.md",
|
||||
"but /root/app_configs ([HA documentation]",
|
||||
"but `/app_configs/webtrees/config.yaml` ([HA documentation]",
|
||||
)
|
||||
replace(
|
||||
"spotify_to_plex/README.md",
|
||||
"/app_configs/<slug>",
|
||||
"/app_configs/<hostname>",
|
||||
)
|
||||
PY
|
||||
|
||||
- name: Restore workflow and commit
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git show HEAD^:.github/workflows/lint.yml > .github/workflows/lint.yml
|
||||
git diff --check
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add -A
|
||||
git commit -m "Address remaining PR review comments"
|
||||
git push
|
||||
|
||||
lint-changes:
|
||||
if: github.event_name == 'push' || github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in new issue
Block a user