mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-10-16 13:09:25 +02:00
Restore lint workflow
This commit is contained in:
180
.github/workflows/lint.yml
vendored
180
.github/workflows/lint.yml
vendored
@@ -16,186 +16,6 @@ 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 reviewed fixes
|
||||
shell: bash
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
|
||||
def replace(path: str, old: str, new: str, *, expected: int = 1) -> None:
|
||||
file = Path(path)
|
||||
text = file.read_text()
|
||||
count = text.count(old)
|
||||
if count != expected:
|
||||
raise SystemExit(f"{path}: expected {expected} occurrence(s), found {count}: {old!r}")
|
||||
file.write_text(text.replace(old, new))
|
||||
|
||||
replace(
|
||||
".templates/01-custom_script.sh",
|
||||
'''if [ ! -f /config/configuration.yaml ] && [ ! -f /config/configuration.json ]; then
|
||||
CONFIGLOCATION="/config"
|
||||
CONFIGFILEBROWSER="/app_configs/${HOSTNAME/-/_}/$slug.sh"
|
||||
else
|
||||
CONFIGLOCATION="/config/addons_autoscripts"
|
||||
CONFIGFILEBROWSER="/homeassistant/addons_autoscripts/$slug.sh"
|
||||
fi''',
|
||||
'''if [ ! -f /config/configuration.yaml ] && [ ! -f /config/configuration.json ]; then
|
||||
CONFIGLOCATION="/config"
|
||||
CONFIGFILEBROWSER="/app_configs/${HOSTNAME/-/_}/$slug.sh"
|
||||
else
|
||||
CONFIGLOCATION="/config/addons_autoscripts"
|
||||
CONFIGFILEBROWSER="/homeassistant/addons_autoscripts/$slug.sh"
|
||||
fi''',
|
||||
)
|
||||
|
||||
replace(
|
||||
"cleanuparr/rootfs/ha_entrypoint.sh",
|
||||
"# We symlink /app/config → /app_configs/cleanuparr (HA persistent storage)",
|
||||
"# We symlink /app/config → /config (HA persistent app_config storage)",
|
||||
)
|
||||
replace(
|
||||
"cleanuparr/rootfs/ha_entrypoint.sh",
|
||||
'HA_DATA_DIR="/app_configs/cleanuparr"',
|
||||
'HA_DATA_DIR="/config"',
|
||||
)
|
||||
replace(
|
||||
"cleanuparr/Dockerfile",
|
||||
"# Our wrapper symlinks /app/config → HA app_config and starts ./Cleanuparr directly.",
|
||||
"# Our wrapper symlinks /app/config → the /config app_config mount and starts ./Cleanuparr directly.",
|
||||
)
|
||||
|
||||
replace(
|
||||
"qbittorrent/rootfs/etc/cont-init.d/00-folders.sh",
|
||||
'echo "Files moved to /app_configs/$HOSTNAME/openvpn" > /homeassistant/addons_config/qBittorrent/migrated',
|
||||
'echo "Files moved to /app_configs/$HOSTNAME/qBittorrent" > /homeassistant/addons_config/qBittorrent/migrated',
|
||||
)
|
||||
replace(
|
||||
"qbittorrent/rootfs/etc/cont-init.d/00-folders.sh",
|
||||
'bashio::log.yellow "... moved files from /config/addons_config/qBittorrent to /app_configs/$HOSTNAME/qBitorrent (must be accessed with my Filebrowser addon)"',
|
||||
'bashio::log.yellow "... moved files from /homeassistant/addons_config/qBittorrent to /app_configs/$HOSTNAME/qBittorrent (must be accessed with my Filebrowser addon)"',
|
||||
)
|
||||
replace(
|
||||
"qbittorrent/rootfs/etc/cont-init.d/00-folders.sh",
|
||||
'bashio::log.yellow "... moved config.yaml from /config/addons_config/qbittorrent to /app_configs/$HOSTNAME"',
|
||||
'bashio::log.yellow "... moved config.yaml from /homeassistant/addons_config/qbittorrent to /app_configs/$HOSTNAME"',
|
||||
)
|
||||
replace(
|
||||
"qbittorrent/rootfs/etc/cont-init.d/00-folders.sh",
|
||||
"/homeassistant/addons_autoscrips/qbittorrent.sh",
|
||||
"/homeassistant/addons_autoscripts/qbittorrent.sh",
|
||||
expected=3,
|
||||
)
|
||||
replace(
|
||||
"qbittorrent/rootfs/etc/cont-init.d/00-folders.sh",
|
||||
'bashio::log.yellow "... moved qbittorrent.sh from /config/addons_autoscripts to /app_configs/$HOSTNAME"',
|
||||
'bashio::log.yellow "... moved qbittorrent.sh from /homeassistant/addons_autoscripts/qbittorrent.sh to /app_configs/$HOSTNAME/qbittorrent.sh"',
|
||||
)
|
||||
replace(
|
||||
"qbittorrent/rootfs/etc/cont-init.d/92-qbit_manage.sh",
|
||||
"/app_configs/$HOSTNAME/qbit_manage/qbit_manage.yaml",
|
||||
"/app_configs/$HOSTNAME/qbit_manage/qbit_manage.yml",
|
||||
)
|
||||
|
||||
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",
|
||||
)
|
||||
|
||||
replace(
|
||||
"mealie/CHANGELOG.md",
|
||||
"/app_configs/db21ed7f_mealie",
|
||||
"/addon_configs/db21ed7f_mealie",
|
||||
expected=4,
|
||||
)
|
||||
replace("mealie/CHANGELOG.md", "backuped", "backed up")
|
||||
replace("mealie/CHANGELOG.md", "occured", "occurred")
|
||||
replace(
|
||||
"mealie/README.md",
|
||||
"/homeassistant/addons_config/xxx-mealie/config.yaml",
|
||||
"/app_configs/xxx-mealie/config.yaml",
|
||||
)
|
||||
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(
|
||||
"gitea/README.md",
|
||||
"/app_configs/gitea/app.ini",
|
||||
"/app_configs/<hostname>/app.ini",
|
||||
expected=2,
|
||||
)
|
||||
replace(
|
||||
"webtrees/README.md",
|
||||
"but /root/app_configs ([HA documentation]",
|
||||
"but in /app_configs/<hostname>/config.yaml ([HA documentation]",
|
||||
)
|
||||
replace(
|
||||
"spotify_to_plex/README.md",
|
||||
"/app_configs/<slug>",
|
||||
"/app_configs/<hostname>",
|
||||
)
|
||||
PY
|
||||
|
||||
- name: Restore temporary workflow changes and commit
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git show HEAD^:.github/workflows/lint.yml > .github/workflows/lint.yml
|
||||
rm -f .github/workflows/agent-address-pr2933-comments.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 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