This commit is contained in:
2024-06-17 17:34:06 +02:00
parent da23315ab9
commit 97b4e2d7b1
409 changed files with 4274 additions and 15396 deletions

6
.github/.gitattributes vendored Normal file
View File

@@ -0,0 +1,6 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary

9
.github/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/

1
.github/CODEOWNERS vendored
View File

@@ -1 +0,0 @@
.github/* @frenck

View File

@@ -1,133 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
frenck@frenck.dev.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][mozilla coc].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][faq]. Translations are available
at [https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[mozilla coc]: https://github.com/mozilla/diversity
[faq]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

View File

@@ -1,29 +0,0 @@
# Contributing
When contributing to this repository, please first discuss the change you wish
to make via issue, email, or any other method with the owners of this repository
before making a change.
Please note we have a code of conduct, please follow it in all your interactions
with the project.
## Issues and feature requests
You've found a bug in the source code, a mistake in the documentation or maybe
you'd like a new feature? You can help us by submitting an issue to our
[GitHub Repository][github]. Before you create an issue, make sure you search
the archive, maybe your question was already answered.
Even better: You could submit a pull request with a fix / new feature!
## Pull request process
1. Search our repository for open or closed [pull requests][prs] that relates
to your submission. You don't want to duplicate effort.
1. You may merge the pull request in once you have the sign-off of two other
developers, or if you do not have permission to do that, you may request
the second reviewer to merge it for you.
[github]: https://github.com/hassio-addons/repository/issues
[prs]: https://github.com/hassio-addons/repository/pulls

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
---
custom: https://buymeacoffee.com/mesteriisw

View File

@@ -1,20 +0,0 @@
# Problem/Motivation
> (Why the issue was filed)
## Expected behavior
> (What you expected to happen)
## Actual behavior
> (What actually happened)
## Steps to reproduce
> (How can someone else make/see it happen)
## Proposed changes
> (If you have a proposed change, workaround or fix,
> describe the rationale behind it)

60
.github/ISSUE_TEMPLATE/BUG-REPORT.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
---
name: "🐛 Bug Report"
description: Create a new ticket for a bug.
title: "🐛 [Addon name] <title>"
labels: [
"bug"
]
body:
- type: textarea
id: description
attributes:
label: "Description"
description: Please enter an explicit description of your issue
placeholder: Short and explicit description of your incident...
validations:
required: true
- type: textarea
id: reprod
attributes:
label: "Reproduction steps"
description: Please enter an explicit description of your issue
value: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
render: bash
validations:
required: true
- type: textarea
id: logs
attributes:
label: "Addon Logs"
description: Please paste the full log that appears when starting the addon (including banner). This will be automatically formatted into code, so no need for backticks.
render: bash
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: "Architecture"
description: What architecture are you on ?
multiple: true
options:
- aarch64
- amd64
- armv7
validations:
required: false
- type: dropdown
id: os
attributes:
label: "OS"
description: What is the impacted environment ?
multiple: true
options:
- HAos
- Virtual Machine
validations:
required: false

2
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
---
blank_issues_enabled: false

View File

@@ -0,0 +1,44 @@
---
name: "✨ Feature request"
description: Suggest an idea for this project
title: "✨ [REQUEST] Addon name"
labels: [
"prevent stale",
"enhancement"
]
body:
- type: markdown
attributes:
value: |
I have a real life job in parallel to this addon, and don't think I'll be able to add new addons for the moment. You can still however express your interest in case someone would do it.
- type: checkboxes
id: terms
attributes:
label: Checked
description: "Pre-checks"
options:
- label: "If a new addon, I have checked on Google that such as addon doesn't already exists"
required: true
- label: "If a new feature, I have searched in the discussions & issues that it was not already covered"
required: true
- type: textarea
id: description
attributes:
label: "Which addon?"
description: The title of the addon the new feature is for
validations:
required: true
- type: textarea
id: description2
attributes:
label: "Is your feature request related to a problem? Please describe"
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when
validations:
required: true
- type: textarea
id: description3
attributes:
label: "Describe the solution you'd like"
description: A clear and concise description of what you want to happen
validations:
required: true

View File

@@ -0,0 +1,41 @@
---
name: "\u2753 Any other question"
about: Other questions or remarks not related to bugs or features
title: "\u2753 [addon] title"
labels: ['prevent stale']
assignees: ""
---
<!-- markdownlint-disable MD036 -->
**Which addon?**
<!--The title of the addon the new feature is for.-->
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Which addon?**
<!--The title of the addon the new feature is for.-->
**Addon or app?**
<!--Are you sure it is linked to the addon? If in the original app, the question should be posed there.-->
**Describe the solution you'd like**
<!--A clear and concise description of what you want to happen.-->
**Describe alternatives you've considered**
<!--A clear and concise description of any alternative solutions or features you've considered.-->
**Additional context**
<!--Add any other context here.-->

View File

@@ -1,9 +0,0 @@
# Proposed Changes
> (Describe the changes and rationale behind them)
## Related Issues
> ([Github link][autolink-references] to related issues or pull requests)
[autolink-references]: https://help.github.com/articles/autolinked-references-and-urls/

1839
.github/SECURITY.md vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +0,0 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
time: "06:00"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: daily
time: "06:00"

10
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
---
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependency-update"

85
.github/labels.yml vendored
View File

@@ -1,85 +0,0 @@
---
- name: "breaking-change"
color: ee0701
description: "A breaking change for existing users."
- name: "bugfix"
color: ee0701
description: "Inconsistencies or issues which will cause a problem for users or implementors."
- name: "documentation"
color: 0052cc
description: "Solely about the documentation of the project."
- name: "enhancement"
color: 1d76db
description: "Enhancement of the code, not introducing new features."
- name: "refactor"
color: 1d76db
description: "Improvement of existing code, not introducing new features."
- name: "performance"
color: 1d76db
description: "Improving performance, not introducing new features."
- name: "new-feature"
color: 0e8a16
description: "New features or options."
- name: "maintenance"
color: 2af79e
description: "Generic maintenance tasks."
- name: "ci"
color: 1d76db
description: "Work that improves the continue integration."
- name: "dependencies"
color: 1d76db
description: "Upgrade or downgrade of project dependencies."
- name: "in-progress"
color: fbca04
description: "Issue is currently being resolved by a developer."
- name: "stale"
color: fef2c0
description: "There has not been activity on this issue or PR for quite some time."
- name: "no-stale"
color: fef2c0
description: "This issue or PR is exempted from the stable bot."
- name: "security"
color: ee0701
description: "Marks a security issue that needs to be resolved asap."
- name: "incomplete"
color: fef2c0
description: "Marks a PR or issue that is missing information."
- name: "invalid"
color: fef2c0
description: "Marks a PR or issue that is missing information."
- name: "beginner-friendly"
color: 0e8a16
description: "Good first issue for people wanting to contribute to the project."
- name: "help-wanted"
color: 0e8a16
description: "We need some extra helping hands or expertise in order to resolve this."
- name: "hacktoberfest"
description: "Issues/PRs are participating in the Hacktoberfest."
color: fbca04
- name: "hacktoberfest-accepted"
description: "Issues/PRs are participating in the Hacktoberfest."
color: fbca04
- name: "priority-critical"
color: ee0701
description: "This should be dealt with ASAP. Not fixing this issue would be a serious error."
- name: "priority-high"
color: b60205
description: "After critical issues are fixed, these should be dealt with before any further issues."
- name: "priority-medium"
color: 0e8a16
description: "This issue may be useful, and needs some attention."
- name: "priority-low"
color: e4ea8a
description: "Nice addition, maybe... someday..."
- name: "major"
color: b60205
description: "This PR causes a major version bump in the version number."
- name: "minor"
color: 0e8a16
description: "This PR causes a minor version bump in the version number."

10
.github/linters/.gitleaks.toml vendored Normal file
View File

@@ -0,0 +1,10 @@
title = "gitleaks config"
[extend]
# useDefault will extend the base configuration with the default gitleaks config:
# https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml
useDefault = false
[allowlist]
description = "global allowlist. whitelisting paths"
#paths = ['''/github/workspace/epicgamesfree/templates/config.json''']

8
.github/linters/.hadolint.yaml vendored Normal file
View File

@@ -0,0 +1,8 @@
---
ignored:
- DL3002
- DL3006
- DL3007
- DL3008
- DL3009
- DL3018

9
.github/linters/.jscpd.json vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"threshold": 0,
"reporters": ["html", "markdown"],
"ignore": [
"**/.git/**",
"**/*.md",
"**/.github/**"
]
}

35
.github/linters/.markdown-lint.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
---
###########################
###########################
## Markdown Linter rules ##
###########################
###########################
# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint
#
# Note:
# To comment out a single error:
# <!-- markdownlint-disable -->
# any violations you want
# <!-- markdownlint-restore -->
#
###############
# Rules by id #
###############
MD001: false # Heading levels should only increment by one level at a time
MD002: false # First header should be a h1 header
MD007: # Unordered list indentation
indent: 2
MD012: false # Multiple consecutive blank lines
MD013: false # Line length
MD025: false # Multiple top level headings in the same document
MD034: false # Bare url
MD041: false # First line in file should be a top level header
MD053: false # Check links are used
#################
# Rules by tags #
#################
blank_lines: false # Error on blank lines

109
.github/paths-filter.yml vendored Normal file
View File

@@ -0,0 +1,109 @@
# AUTO BUILDS #
# From https://github.com/Poeschl/Hassio-Addons
# name: slug/filename ; could be slug/config.* for all files
addons_updater: addons_updater/config.* # Image : yes
arpspoof: arpspoof/config.* # Image : yes
autobrr: autobrr/config.* # Image : yes
baikal: baikal/config.* # Image : yes
bazarr: bazarr/config.* # Image : yes
binance-trading-bot: binance-trading-bot/config.* # Image : yes
birdnet-go: birdnet-go/config.* # Image : yes
birdnet-pi: birdnet-pi/config.* # Image : yes
bitwarden: bitwarden/config.* # Image : yes
booksonic_air: booksonic_air/config.* # Image : yes
browserless_chrome: browserless_chrome/config.* # Image : yes
calibre: calibre/config.* # Image : yes
calibre_web: calibre_web/config.* # Image : yes
changedetection.io: changedetection.io/config.* # Image : yes
cloudcommander: cloudcommander/config.* # Image : yes
code-server: code-server/config.* # Image : yes
codex: codex/config.* # Image : yes
comixed: comixed/config.* # Image : yes
elasticsearch: elasticsearch/config.* # Image : yes
emby: emby/config.* # Image : yes
enedisgateway2mqtt: enedisgateway2mqtt/config.* # Image : yes
enedisgateway2mqtt_dev: enedisgateway2mqtt_dev/config.* # Image : yes
epicgamesfree: epicgamesfree/config.* # Image : yes
filebrowser: filebrowser/config.* # Image : yes
fireflyiii: fireflyiii/config.* # Image : yes
fireflyiii_data_importer: fireflyiii_data_importer/config.* # Image : yes
fireflyiii_fints_importer: fireflyiii_fints_importer/config.* # Image : yes
flaresolverr: flaresolverr/config.* # Image : yes
flexget: flexget/config.* # Image : yes
free_games_claimer: free_games_claimer/config.* # Image : yes
gazpar2mqtt: gazpar2mqtt/config.* # Image : yes
gitea: gitea/config.* # Image : yes
grav: grav/config.* # Image : yes
guacamole: guacamole/config.* # Image : yes
immich: immich/config.* # Image : yes
immich_ingress: immich_ingress/config.* # Image : yes
inadyn: inadyn/config.* # Image : yes
jackett: jackett/config.* # Image : yes
jellyfin: jellyfin/config.* # Image : yes
jellyseerr: jellyseerr/config.* # Image : yes
joal: joal/config.* # Image : yes
joplin: joplin/config.* # Image : yes
lidarr: lidarr/config.* # Image : yes
linkwarden: linkwarden/config.* # Image : yes
mealie: mealie/config.* # Image : yes
mealie_api: mealie_api/config.* # Image : yes
mealie_frontend: mealie_frontend/config.* # IImage : yes # Image : yes
myelectricaldata: myelectricaldata/config.* # Image : yes
myelectricaldata_dev: myelectricaldata_dev/config.* # Image : yes
mylar3: mylar3/config.* # Image : yes
navidrome: navidrome/config.* # Image : yes
nextcloud: nextcloud/config.* # Image : yes
nzbget: nzbget/config.* # Image : yes
omada: omada/config.* # Image : yes
omada_v3: omada_v3/config.* # Image : yes
ombi: ombi/config.* # Image : yes
openproject: openproject/config.* # Image : yes
organizr: organizr/config.* # Image : yes
overleaf: overleaf/config.* # Image : yes
overseerr: overseerr/config.* # Image : yes
paperless_ngx: paperless_ngx/config.* # Image : yes
papermerge: papermerge/config.* # Image : yes
photoprism: photoprism/config.* # Image : yes
piwigo: piwigo/config.* # Image : yes
plex: plex/config.* # Image : yes
plex_meta_manager: plex_meta_manager/config.* # Image : yes
portainer: portainer/config.* # Image : yes
portainer_agent: portainer_agent/config.* # Image : yes
postgres: postgres/config.* # Image : yes
prowlarr: prowlarr/config.* # Image : yes
qbittorrent: qbittorrent/config.* # Image : yes
radarr: radarr/config.* # Image : yes
readarr: readarr/config.* # Image : yes
requestrr: requestrr/config.* # Image : yes
resiliosync: resiliosync/config.* # Image : yes
sabnzb: sabnzb/config.* # Image : yes
sabnzbd: sabnzbd/config.* # Image : yes
scrutiny: scrutiny/config.* # Image : yes
scrutiny_fa: scrutiny_fa/config.* # Image : yes
seafile: seafile/config.* # Image : yes
signalk: signalk/config.* # Image : yes
socks5-proxy: socks5-proxy/config.* # Image : yes
sonarr: sonarr/config.* # Image : yes
sponsorblockcast: sponsorblockcast/config.* # Image : yes
spotweb: spotweb/config.* # Image : yes
tandoor_recipes: tandoor_recipes/config.* # Image : yes
tdarr: tdarr/config.* # Image : yes
teamspeak: teamspeak/config.* # Image : yes
transmission: transmission/config.* # Image : yes
transmission_openvpn: transmission_openvpn/config.* # Image : yes
ubooquity: ubooquity/config.* # Image : yes
unpackerr: unpackerr/config.* # Image : yes
vaultwarden: vaultwarden/config.* # Image : yes
webtop: webtop/config.*
webtop_kde: webtop_kde/config.* # Image : yes
webtrees: webtrees/config.* # Image : yes
wger: wger/config.* # Image : yes
whatsapper: whatsapper/config.* # Image : yes
whoogle: whoogle/config.* # Image : yes
xteve: xteve/config.* # Image : yes
zoneminder: zoneminder/config.* # Image : yes
zzz_archived_bitwarden: zzz_archived_bitwarden/config.* # Image : yes
zzz_archived_code-server: zzz_archived_code-server/config.* # Image : yes
zzz_archived_paperless_ngx: zzz_archived_paperless_ngx/config.* # Image : yes
zzz_draft_birdnet-pi: zzz_draft_birdnet-pi/config.* # Image : yes
zzz_draft_overleaf: zzz_draft_overleaf/config.* # Image : yes

View File

@@ -0,0 +1,65 @@
---
name: Lint / Syntax checks
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
hadolint:
runs-on: ubuntu-latest
container: ghcr.io/hadolint/hadolint:latest-alpine
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: Get changed files
id: changed_files
uses: jitterbit/get-changed-files@v1
- name: 🔎 Run hadolint
run: |
# shellcheck disable=SC2043
for files in ${{ steps.changed_files.outputs.all }}; do
if [[ "$(basename ${files})" == "Dockerfile" ]]; then
echo "Hadolint $files"
hadolint "$files"
fi
done
shellcheck:
runs-on: ubuntu-latest
container: koalaman/shellcheck-alpine:latest
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: Get changed files
id: changed_files
uses: jitterbit/get-changed-files@v1
- name: 🔎 Run ShellCheck
run: |
# shellcheck disable=SC2043
for files in ${{ steps.changed_files.outputs.all }}; do
if [[ "$files" == *".sh" ]]; then
echo "Spellcheck $files"
shellcheck "$files"
fi
done
markdownlint:
runs-on: ubuntu-latest
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: 🔎 Run markdownlint
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
config_file: .markdownlint.yaml

157
.github/workflows/daily_README.yaml vendored Normal file
View File

@@ -0,0 +1,157 @@
# yamllint disable rule:line-length
---
name: Generate README
on:
schedule:
- cron: 0 17 * * *
workflow_dispatch: null
jobs:
README_updater:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Create README file
run: |
# Init
echo "Starting"
# Prepare template
cp .templates/.README.md README2.md
ADDONSLINE="$(sed -n '/%%ADDONS_LIST%%/=' README2.md)"
sed -i "/**ADDONS_LIST%%/d" README2.md
# Sort folders by addon name
# shellcheck disable=SC2086
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do
if [ -f "$f"/config.json ]; then
NAME=$(jq -r '.name' "$f"/config.json)
if [[ "$f" != "$NAME" ]]; then
echo "$f" > "$f"/oldname
mv "$f" "$NAME"
fi
fi
done
# Populate template
find -- * -maxdepth 0 -type d | sort -r | while read -r f; do
# $f is an addon directory
if [ -f "$f/config.json" ]; then
echo "Project $f"
# Get variables
if [ -f "$f/oldname" ]; then FOLDERNAME="$(cat "$f/oldname")"; else FOLDERNAME="$f"; fi
NAME="$(jq -r '.name' "$f/config.json")"
DESCRIPTION="$(jq -r '.description' "$f/config.json")"
# Get icon
if [ "$(jq '.panel_icon' "$f/config.json")" != null ]; then
ICON="$(jq -r '.panel_icon' "$f/config.json")"
ICON="${ICON#*:}"
ICON="![image](https://api.iconify.design/mdi/$ICON.svg)"
else
ICON=""
fi
# Write infos
echo "Writing infos"
sed -i "$ADDONSLINE"'{G;}' README2.md
if [[ "$(jq '.schema' "$f/config.json" 2>/dev/null)" == *"localdisks"* ]]; then sed -i "$ADDONSLINE"'a ![localdisks][localdisks-badge]' README2.md; fi
if [[ "$(jq '.schema' "$f/config.json" 2>/dev/null)" == *"networkdisks"* ]]; then sed -i "$ADDONSLINE"'a ![smb][smb-badge]' README2.md; fi
if [[ "$(jq '.full_access' "$f/config.json" 2>/dev/null)" == "true" ]]; then sed -i "$ADDONSLINE"'a ![full_access][full_access-badge]' README2.md; fi
if [[ "$(jq '.services[]' "$f/config.json" 2>/dev/null)" == *"mqtt"* ]]; then sed -i "$ADDONSLINE"'a ![mqtt][mqtt-badge]' README2.md; fi
if [[ "$(jq '.services[]' "$f/config.json" 2>/dev/null)" == *"mysql"* ]]; then sed -i "$ADDONSLINE"'a ![MariaDB][mariadb-badge]' README2.md; fi
if [[ "$(jq '.ingress' "$f/config.json" 2>/dev/null)" == "true" ]]; then sed -i "$ADDONSLINE"'a ![ingress][ingress-badge]' README2.md; fi
if [[ "$(jq '.arch[]' "$f/config.json")" == *"armv7"* ]]; then
sed -i "$ADDONSLINE"'a ![armv7][armv7-badge]' README2.md
else sed -i "$ADDONSLINE"'a ![armv7no][armv7no-badge]' README2.md; fi || true
if [[ "$(jq '.arch[]' "$f/config.json")" == *"amd64"* ]]; then
sed -i "$ADDONSLINE"'a ![amd64][amd64-badge]' README2.md
else sed -i "$ADDONSLINE"'a ![amd64no][amd64no-badge]' README2.md; fi || true
if [[ "$(jq '.arch[]' "$f/config.json")" == *"aarch64"* ]]; then
sed -i "$ADDONSLINE"'a ![aarch64][aarch64-badge]' README2.md
else sed -i "$ADDONSLINE"'a ![aarch64no][aarch64no-badge]' README2.md; fi || true
if [[ -f "$f/updater.json" ]]; then sed -i "$ADDONSLINE"'a ![Update](https://img.shields.io/badge/dynamic/json?label=Updated&query=%24.last_update&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2F'"$FOLDERNAME"'%2Fupdater.json)' README2.md; fi
sed -i "$ADDONSLINE"'a &emsp;&emsp;![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2F'"$FOLDERNAME"'%2Fconfig.json)' README2.md || true
sed -i "$ADDONSLINE"'a &#10003; '"$ICON"' ['"$NAME"']('"$FOLDERNAME"'/) : '"$DESCRIPTION\\n" README2.md
fi
done
# Restore folders name
echo "Restore structure..."
find -- * -maxdepth 0 -type d | sort -r | while read -r f; do
if [ -f "$f/oldname" ]; then
NAME="$(cat "$f/oldname")"
rm "$f/oldname"
mv "$f" "$NAME"
fi
done
echo "... done"
# Write stats
# shellcheck disable=SC2002
echo "Global stats..."
STATS_DOWNLOADS="$(awk 'NR==2{print $1}' Stats)"
sed -i "s|%%STATS_DOWNLOADS%%|$STATS_DOWNLOADS|g" README2.md && \
sed -i "s|%%STATS_ADDONS%%|$(find . -name "config.json" | wc -l)|g" README2.md && \
STATS_ONE="$(awk 'NR==3{print $(NF)}' Stats)" && \
STATS_TWO="$(awk 'NR==4{print $(NF)}' Stats)" && \
STATS_THREE="$(awk 'NR==5{print $(NF)}' Stats)"
echo "Best addon is $STATS_ONE"
sed -i "s|%%STATS_ONE%%|${STATS_ONE^}|g" README2.md
sed -i "s|%%STATS_TWO%%|${STATS_TWO^}|g" README2.md
sed -i "s|%%STATS_THREE%%|${STATS_THREE^}|g" README2.md
echo "... done"
# Breakdown per arch
echo "Breakdown per arch..."
STATS_ARMV7="$(awk '{SUM+=$3}END{print SUM}' Stats2)"
STATS_AMD64="$(awk '{SUM+=$4}END{print SUM}' Stats2)"
STATS_AARCH64="$(awk '{SUM+=$5}END{print SUM}' Stats2)"
STATS_DOWNLOADS="$(( "$STATS_ARMV7" + "$STATS_AMD64" + "$STATS_AARCH64" ))"
STATS_ARMV7="$(awk -v t1="$STATS_ARMV7" -v t2="$STATS_AMD64" -v t3="$STATS_AARCH64" -v t4="$STATS_DOWNLOADS" 'BEGIN{printf "%.0f", t1/t4 * 100}')"
STATS_AMD64="$(awk -v t1="$STATS_ARMV7" -v t2="$STATS_AMD64" -v t3="$STATS_AARCH64" -v t4="$STATS_DOWNLOADS" 'BEGIN{printf "%.0f", t2/t4 * 100}')"
STATS_AARCH64="$(awk -v t1="$STATS_ARMV7" -v t2="$STATS_AMD64" -v t3="$STATS_AARCH64" -v t4="$STATS_DOWNLOADS" 'BEGIN{printf "%.0f", t3/t4 * 100}')"
sed -i "s|%%STATS_ARMV7%%|armv7: ${STATS_ARMV7}%|g" README2.md
sed -i "s|%%STATS_AMD64%%|amd64: ${STATS_AMD64}%|g" README2.md
sed -i "s|%%STATS_AARCH64%%|aarch64: ${STATS_AARCH64}%|g" README2.md
#echo $((100*$STATS_THREE/($STATS_ONE+$STATS_TWO+$STATS_THREE)))
echo "... done"
for var in "$STATS_ONE" "$STATS_TWO" "$STATS_THREE"; do
i=0
j=0
k=0
# shellcheck disable=SC2013
for i in $(sed -n "/$var/p" Stats); do
k="$((k+1))"
if [ "$k" -eq 3 ]; then break; fi
if [ "$i" -eq "$i" ] && [ "$i" -gt "$j" ]; then j="$i"; fi
done
sed -i "s|${var^}|${var^} (${j}x)|g" README2.md
echo "$STATS_ONE has $j downloads"
done
echo "... done"
# Replace template if change
echo "Replace template..."
mv README2.md README.md
echo "... done"
shell: bash
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
message: "GitHub bot : README updated"
default_author: github_actions

33
.github/workflows/daily_stale.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
# This workflow warns and then closes issues and PRs
# that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
---
name: Mark stale issues and pull requests
on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v8
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
stale-pr-message: 'Stale pull request message'
stale-issue-label: 'stale'
stale-pr-label: 'stale'
days-before-stale: '5'
days-before-close: '2'
exempt-issue-labels: 'prevent stale'
remove-stale-when-updated: true

View File

@@ -0,0 +1,242 @@
# yamllint disable rule:line-length
---
name: Generate weekly graphs
on:
workflow_call:
workflow_dispatch:
jobs:
stats_graphs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install apps
run: |
git pull --rebase origin master
sudo apt-get update
sudo apt-get install gnuplot -y || true
- name: Create addons stats
run: |
# Prepare data
cp Stats Stats3
# Remove Totals
sed -i "2d" Stats3
# Inverse file
gawk -i inplace '{for(i=NF;i>1;i--)printf "%s ",$i;printf "%s",$1;print ""}' Stats3
# Only top 10
head -n 11 Stats3 > tmp_file && mv tmp_file Stats3
# Transpose data
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' Stats3 > StatsTmp && mv StatsTmp .github/Stats3
cd .github || true
# Add download count to names
#build_list="$(head -n 1 Stats3)"
# shellcheck disable=SC2206
#build_list=($build_list)
# shellcheck disable=SC2013
#for var in "${build_list[@]:1}"; do
#i=0
#j=0
#k=0
# shellcheck disable=SC2013
# for i in $(sed -n "/${var}/p" Stats); do
# k="$((k+1))"
# if [ "$k" -eq 3 ]; then break; fi
# if [ "$i" -eq "$i" ] && [ "$i" -gt "$j" ]; then j="$i"; fi
# done
#sed -i "s|${var}|${var}_(${j}x)|g" Stats3
#done
echo "... done"
# Remove series with less than 4 points
sed -i "/^[0-9|-]* [0-9*|-]* [0-9*|-]* -/d" Stats3
# Plot graph
( gnuplot -persist <<-EOFMarker
set title 'Top 10 addons'
set ylabel 'Number of installations'
set xdata time
set datafile missing "-"
set timefmt "%Y-%m-%d"
set format x "%y-%m-%d"
set datafile sep ' '
set autoscale
set terminal png size 500,300
set output 'stats_addons.png'
set term png tiny
plot for [i=2:*] 'Stats3' using 1:i w l title columnhead(i) smooth bezier
EOFMarker
) || ( gnuplot -persist <<-EOFMarker
set title 'Top 10 addons'
set ylabel 'Number of installations'
set xdata time
set datafile missing "-"
set timefmt "%Y-%m-%d"
set format x "%y-%m-%d"
set datafile sep ' '
set autoscale
set terminal png size 500,300
set output 'stats_addons.png'
set term png tiny
plot for [i=2:*] 'Stats3' using 1:i w l title columnhead(i)
EOFMarker
)
#plot for [i=1:*] 'Stats3' using 0:i
rm Stats3
cd .. || true
- name: Create individual stats
run: |
# Prepare data
cp Stats Stats3
# Remove Totals
sed -i "2d" Stats3
# Inverse file
gawk -i inplace '{for(i=NF;i>1;i--)printf "%s ",$i;printf "%s",$1;print ""}' Stats3
# For each addon
# shellcheck disable=SC2013
for line in $(awk '{ print $1 }' Stats3); do
TITLE="${line%% *}"
FOLDER="$(grep -irl "ghcr.io/alexbelgium/$TITLE-{arch}" --include="config.*" . | xargs -r dirname)"
FOLDER="${FOLDER:2}"
echo "$TITLE found in $FOLDER"
# If non null
if [[ "${#FOLDER}" -gt 2 ]]; then
sed -n "/Date /p" Stats3 > "$FOLDER"/StatsTmp
sed -n "/$TITLE /p" Stats3 >> "$FOLDER"/StatsTmp
# Go in folder
cd "$FOLDER" || true
cat StatsTmp
# Transpose data
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' StatsTmp > StatsTmp2 && mv StatsTmp2 StatsTmp
#Normalize data
#awk 'FNR==NR{max=($2+0>max)?$2:max;next} {print $1,$2/max}' StatsTmp StatsTmp
# Plot graph
( gnuplot -persist <<-EOFMarker
set title "$TITLE"
set ylabel 'Number of installations'
set xdata time
set datafile missing "-"
set timefmt "%Y-%m-%d"
set format x "%y-%m-%d"
set datafile sep ' '
set autoscale
set terminal png size 500,150
set output "stats.png"
set term png tiny
plot for [i=2:*] 'StatsTmp' using 1:i w l title columnhead(i) smooth bezier
EOFMarker
) || ( gnuplot -persist <<-EOFMarker
set title "$TITLE"
set ylabel 'Number of installations'
set xdata time
set datafile missing "-"
set timefmt "%Y-%m-%d"
set format x "%y-%m-%d"
set datafile sep ' '
set autoscale
set terminal png size 500,150
set output "stats.png"
set term png tiny
plot for [i=2:*] 'StatsTmp' using 1:i w l title columnhead(i)
EOFMarker
) || true
rm StatsTmp || true
cd .. || true
fi || true
done
# Clean files
rm StatsTmp2
rm Stats3
- name: Create global stats
run: |
# Prepare data
cp Stats Stats3
# Inverse file
gawk -i inplace '{for(i=NF;i>1;i--)printf "%s ",$i;printf "%s",$1;print ""}' Stats3
# Only totals
head -n 2 Stats3 > tmp_file && mv tmp_file Stats3
# Transpose data
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' Stats3 > StatsTmp && mv StatsTmp .github/Stats3
cd .github || true
sed -i "1d" Stats3
# Plot graph
gnuplot -persist <<-EOFMarker
set title 'Total addons'
set ylabel 'Number of installations'
set xdata time
set datafile missing "-"
set timefmt "%Y-%m-%d"
set format x "%y-%m-%d"
set datafile sep ' '
set key top left autotitle columnheader
set autoscale
set terminal png size 500,300
set output 'stats.png'
set term png tiny
plot 'Stats3' using 1:2 lt rgb 'red' w l title 'Total addons' smooth bezier
EOFMarker
rm Stats3
cd .. || true
- name: Clean
run: |
echo "Starting run"
if [ -f stats.png ]; then rm stats.png; fi
if [ -f Stats3 ]; then rm Stats3; fi
- name: Update stars
run: |
echo "Starting run"
# Get stars
wget -S -O .github/stars.svg https://contrib.rocks/image?repo=Mesteriis/hassio-addons-avm || true
# Get stars2
wget -S -O .github/stars2.svg https://git-lister.onrender.com/api/stars/Mesteriis/hassio-addons-avm?limit=30 || true
# Get stars evolution
wget -S -O .github/starsevol.svg "https://api.star-history.com/svg?repos=Mesteriis/hassio-addons-avm&type=Date" || true
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
message: "GitHub bot : graphs updated"
default_author: github_actions

View File

@@ -1,22 +0,0 @@
---
name: Sync labels
# yamllint disable-line rule:truthy
on:
push:
branches:
- master
paths:
- .github/labels.yml
jobs:
labels:
name: ♻️ Sync labels
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v2.3.4
- name: 🚀 Run Label Syncer
uses: micnncim/action-label-syncer@v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,33 +0,0 @@
---
name: Lint
# yamllint disable-line rule:truthy
on:
push:
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
jobs:
json:
name: JSON Lint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v2.3.4
- name: 🚀 Run JQ
run: |
shopt -s globstar
cat **/*.json | jq '.'
yamllint:
name: YAMLLint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v2.3.4
- name: 🚀 Run YAMLLint
uses: frenck/action-yamllint@v1.1

View File

@@ -1,21 +0,0 @@
---
name: Lock
# yamllint disable-line rule:truthy
on:
schedule:
- cron: "0 9 * * *"
workflow_dispatch:
jobs:
lock:
name: 🔒 Lock closed issues and PRs
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2.0.3
with:
github-token: ${{ github.token }}
issue-lock-inactive-days: "30"
issue-lock-reason: ""
pr-lock-inactive-days: "1"
pr-lock-reason: ""

69
.github/workflows/on_issues.yml vendored Normal file
View File

@@ -0,0 +1,69 @@
# yamllint disable rule:line-length
---
name: Readme Issues linker
on:
issues:
types: [opened, edited, closed]
workflow_dispatch:
jobs:
ISSUES_linked:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Assign issues
run: |
# Init
echo "Starting"
# Get issues list
curl -s -L https://api.github.com/repos/Mesteriis/hassio-addons-avm/issues > issueslist
# Go through all folders, add to filters if not existing
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do
if [ -f "$f"/config.json ]; then
# Clean previously reported issues
sed -i "/Open Issue :/d" "$f"/README.md
sed -i "/Open Request :/d" "$f"/README.md
# If there is an issue with the addon name in title, put a message
COUNTER=0
while [[ $(jq -r --arg COUNTER "$COUNTER" ".[$COUNTER].title" issueslist) != null ]]; do
#Increment counter
(( COUNTER=COUNTER+1 )) || true
#Get variables
TITLE="$(jq -r --arg COUNTER "$COUNTER" ".[$COUNTER].title" issueslist)"
TITLE="${TITLE//[<>\$\'\"]/}"
#Check if relevant to addon
SLUG="$(jq -r --arg f "$f" ".slug" "$f"/config.json)"
NAME="$(jq -r --arg f "$f" ".name" "$f"/config.json)"
if [[ "${TITLE,,}" == *"${f,,}"* ]] || [[ "${TITLE,,}" == *"${SLUG,,}"* ]] || [[ "${TITLE,,}" == *"${NAME,,}"* ]]; then
echo "Project $TITLE, $SLUG, $NAME has an issue"
REQ="$(jq -r --arg COUNTER "$COUNTER" ".[$COUNTER].user.login" issueslist)"
URL="$(jq -r --arg COUNTER "$COUNTER" ".[$COUNTER].html_url" issueslist)"
LABEL="$(jq -r --arg COUNTER "$COUNTER" ".[$COUNTER].labels[].name" issueslist)"
DATEISSUE="$(jq -r --arg COUNTER "$COUNTER" ".[$COUNTER].created_at" issueslist)"
DATEISSUE="${DATEISSUE%T*}"
if [[ "$LABEL" == *"bug"* ]]; then
sed -i "1i ## &#9888; Open Issue : [$TITLE (opened ${DATEISSUE})]($URL) by [@${REQ}](https://github.com/$REQ)" "$f"/README.md
elif [[ "$LABEL" == *"enhancement"* ]]; then
sed -i "1i ## &#9888; Open Request : [$TITLE (opened ${DATEISSUE})]($URL) by [@${REQ}](https://github.com/$REQ)" "$f"/README.md
fi
fi
done
fi
done
# Remove issues list
rm issueslist
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
message: "Github bot : issues linked to readme"
default_author: github_actions
commit: -u
fetch: --force
push: --force

40
.github/workflows/onpr_automerge.yaml vendored Normal file
View File

@@ -0,0 +1,40 @@
# yamllint disable rule:line-length
# shellcheck disable=SC2043
---
name: automerge
on:
pull_request_review:
types:
- submitted
issue_comment:
types: created
check_suite:
types:
- completed
status: {}
jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Add the automerge label
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/automerge') }}
uses: actions/github-script@v4
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['automerge']
})
automerge:
runs-on: ubuntu-latest
needs: [labeler]
steps:
- id: automerge
if: ${{ github.event.issue.pull_request }}
name: automerge
uses: "pascalgn/automerge-action@v0.16.2"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

276
.github/workflows/onpr_check-pr.yaml vendored Normal file
View File

@@ -0,0 +1,276 @@
# yamllint disable rule:line-length
# shellcheck disable=SC2043
---
name: PR Check Build
on:
pull_request:
branches:
- master
jobs:
check-addon-changes:
runs-on: ubuntu-latest
outputs:
changedAddons: ${{ steps.filter.outputs.changes }}
changedChangelogFiles: ${{ steps.changed-files.outputs.changelogs_files }}
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: 📂 Detect changed addons
uses: dorny/paths-filter@v3
id: filter
with:
filters: .github/paths-filter.yml
- name: 📂 Detect chanced files
uses: dorny/paths-filter@v3
id: changed-files
with:
list-files: csv
filters: |
changelogs:
- '**/CHANGELOG.md'
check-changed-changelog:
name: Check if CHANGELOG.md changed
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
runs-on: ubuntu-latest
needs: check-addon-changes
strategy:
fail-fast: false
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
steps:
- name: 🔎 Check for updated CHANGELOG.md
shell: bash
run: |
# shellcheck disable=SC2076,SC2059
if [[ ! "${{ needs.check-addon-changes.outputs.changedChangelogFiles }}" =~ "${{ matrix.addon }}/CHANGELOG.md" ]]; then
echo "::error::No new entries in ${{ matrix.addon }} CHANGELOG.md file!"
exit 1
fi
check-addon-label:
name: Check for existance of the addon label
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
runs-on: ubuntu-latest
needs: check-addon-changes
strategy:
fail-fast: false
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: 🔎 Check if a label for the addon exists
shell: bash
run: |
labeltext=$(sed -nr "/${{ matrix.addon }}/p" '.github/paths-filter.yml')
if [[ -z "$labeltext" ]]; then
echo "::error::There is no label for this addon! Please add it to .github/paths-filter.yml"
exit 1
fi
addon-linter:
name: Addon linting
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
runs-on: ubuntu-latest
needs: check-addon-changes
strategy:
fail-fast: false
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: 🔎 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2
with:
path: "./${{ matrix.addon }}"
check-build:
name: Test addon build
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
runs-on: ubuntu-latest
needs: check-addon-changes
strategy:
fail-fast: false
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: Gather addon info
id: information
uses: frenck/action-addon-information@v1.4
with:
path: "./${{ matrix.addon }}/"
- name: 🗄️ Cache docker layers
uses: actions/cache@v3
with:
path: /tmp/buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.addon }}-${{ hashFiles('**/Dockerfile') }}
restore-keys: ${{ runner.os }}-buildx-${{ matrix.addon }}-
- name: 🔖 Create addon image tags
id: tags
shell: bash
run: |
imagetemplate=${{ steps.information.outputs.image }}
version=${{ steps.information.outputs.version }}
echo "Using imagetemplate '$imagetemplate'"
# shellcheck disable=SC2129
echo "armhf=${imagetemplate/\{arch\}/armhf}:${version}" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "armv7=${imagetemplate/\{arch\}/armv7}:${version}" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "aarch64=${imagetemplate/\{arch\}/aarch64}:${version}" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "amd64=${imagetemplate/\{arch\}/amd64}:${version}" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "i386=${imagetemplate/\{arch\}/i386}:${version}" >> "$GITHUB_OUTPUT"
- name: 🏷️ Create addon labels
id: labels
shell: bash
run: |
exit 0
# shellcheck disable=SC2076,SC2059
labels="io.hass.version=${{ steps.information.outputs.version }}"
labels=$(printf '%s' "$labels\nio.hass.name=${{ steps.information.outputs.name }}")
labels=$(printf '%s' "$labels\nio.hass.description=${{ steps.information.outputs.description }}")
labels=$(printf '%s' "$labels\nio.hass.type=addon")
labels=$(printf '%s' "$labels\nio.hass.url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/master/${{ matrix.addon }}")
labels=$(printf '%s' "$labels\norg.opencontainers.image.title=${{ steps.information.outputs.name }}")
labels=$(printf '%s' "$labels\norg.opencontainers.image.description=${{ steps.information.outputs.description }}")
labels=$(printf '%s' "$labels\norg.opencontainers.image.version=${{ steps.information.outputs.version }}")
labels=$(printf '%s' "$labels\norg.opencontainers.image.authors=Poeschl <Poeschl@users.noreply.github.com>")
labels=$(printf '%s' "$labels\norg.opencontainers.image.url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}")
labels=$(printf '%s' "$labels\norg.opencontainers.image.source=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/master/${{ matrix.addon }}")
labels=$(printf '%s' "$labels\norg.opencontainers.image.created=$(date -Is)")
labels=$(printf '%s' "$labels\norg.opencontainers.image.revision=${GITHUB_SHA}")
echo "Generic labels: $labels"
armhf_labels=$(printf '%s' "$labels\nio.hass.arch=armhf")
armv7_labels=$(printf '%s' "$labels\nio.hass.arch=armv7")
aarch64_labels=$(printf '%s' "$labels\nio.hass.arch=aarch64")
amd64_labels=$(printf '%s' "$labels\nio.hass.arch=amd64")
i386_labels=$(printf '%s' "$labels\nio.hass.arch=i386")
# allow multiline outputs, see https://github.community/t/set-output-truncates-multiline-strings/16852
armhf_labels="${armhf_labels//$'\n'/'%0A'}"
armv7_labels="${armv7_labels//$'\n'/'%0A'}"
aarch64_labels="${aarch64_labels//$'\n'/'%0A'}"
amd64_labels="${amd64_labels//$'\n'/'%0A'}"
i386_labels="${i386_labels//$'\n'/'%0A'}"
# shellcheck disable=SC2129
echo "armhf=$armhf_labels" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "armv7=$armv7_labels" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "aarch64=$aarch64_labels" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "amd64=$amd64_labels" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "i386=$i386_labels" >> "$GITHUB_OUTPUT"
- name: 💽 Create addon build-args
id: build_args
shell: bash
run: |
# shellcheck disable=SC2129
echo "armhf=BUILD_FROM=$(jq -r .build_from.armhf // empty ${{ steps.information.outputs.build }})" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "armv7=BUILD_FROM=$(jq -r .build_from.armv7 // empty ${{ steps.information.outputs.build }})" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "aarch64=BUILD_FROM=$(jq -r .build_from.aarch64 // empty ${{ steps.information.outputs.build }})" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "amd64=BUILD_FROM=$(jq -r .build_from.amd64 // empty ${{ steps.information.outputs.build }})" >> "$GITHUB_OUTPUT"
# shellcheck disable=SC2129
echo "i386=BUILD_FROM=$(jq -r .build_from.i386 // empty ${{ steps.information.outputs.build }})" >> "$GITHUB_OUTPUT"
- name: 🏗️ Set up QEMU
uses: docker/setup-qemu-action@v3
- name: 🏗️ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 💿 Build Addon - armhf
if: ${{ steps.information.outputs.armhf == 'true' }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.addon }}
push: false
load: true
file: ${{ matrix.addon }}/Dockerfile
tags: ${{ steps.tags.outputs.armhf }}
labels: |
${{ steps.labels.outputs.armhf }}
build-args: ${{ steps.build_args.outputs.armhf }}
cache-from: type=local,src=/tmp/buildx-cache/armhf
cache-to: type=local,dest=/tmp/buildx-cache-new/armhf
- name: 💿 Build Addon - armv7
if: ${{ steps.information.outputs.armv7 == 'true' }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.addon }}
push: false
load: true
file: ${{ matrix.addon }}/Dockerfile
tags: ${{ steps.tags.outputs.armv7 }}
labels: |
${{ steps.labels.outputs.armv7 }}
build-args: ${{ steps.build_args.outputs.armv7 }}
cache-from: type=local,src=/tmp/buildx-cache/armv7
cache-to: type=local,dest=/tmp/buildx-cache-new/armv7
- name: 💿 Build Addon - aarch64
if: ${{ steps.information.outputs.aarch64 == 'true' }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.addon }}
push: false
load: true
file: ${{ matrix.addon }}/Dockerfile
tags: ${{ steps.tags.outputs.aarch64 }}
labels: |
${{ steps.labels.outputs.aarch64 }}
build-args: ${{ steps.build_args.outputs.aarch64 }}
cache-from: type=local,src=/tmp/buildx-cache/aarch64
cache-to: type=local,dest=/tmp/buildx-cache-new/aarch64
- name: 💿 Build Addon - amd64
if: ${{ steps.information.outputs.amd64 == 'true' }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.addon }}
push: false
load: true
file: ${{ matrix.addon }}/Dockerfile
tags: ${{ steps.tags.outputs.amd64 }}
labels: |
${{ steps.labels.outputs.amd64 }}
build-args: ${{ steps.build_args.outputs.amd64 }}
cache-from: type=local,src=/tmp/buildx-cache/amd64
cache-to: type=local,dest=/tmp/buildx-cache-new/amd64
- name: 💿 Build Addon - i386
if: ${{ steps.information.outputs.i386 == 'true' }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.addon }}
push: false
load: true
file: ${{ matrix.addon }}/Dockerfile
tags: ${{ steps.tags.outputs.i386 }}
labels: |
${{ steps.labels.outputs.i386 }}
build-args: ${{ steps.build_args.outputs.i386 }}
cache-from: type=local,src=/tmp/buildx-cache/i386
cache-to: type=local,dest=/tmp/buildx-cache-new/i386
# Fix for https://github.com/docker/build-push-action/issues/252
- name: 🗄️ Update cache Folder
run: |
rm -rf /tmp/buildx-cache
mv /tmp/buildx-cache-new /tmp/buildx-cache

232
.github/workflows/onpush_builder.yaml vendored Normal file
View File

@@ -0,0 +1,232 @@
# yamllint disable rule:line-length
# inspired from https://github.com/Poeschl/Hassio-Addons
---
name: Builder
env:
BUILD_ARGS: ""
on:
workflow_call:
push:
branches:
- master
paths:
- "**/config.*"
jobs:
correct_path_filters:
runs-on: ubuntu-latest
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: Update path_filters
run: |
# Init
echo "Starting"
# Go through all folders, add to filters if not existing
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do
if [ -f "$f"/config.json ]; then
# Add to file
if ! grep "$f:" ".github/paths-filter.yml"; then
echo "$f: $f/config.*" >> ".github/paths-filter.yml"
fi
# Identify addons with true images
if [ "$(jq '.image' "$f/config.json")" != null ]; then
sed -i "/$f/ s/ # Image : yes//g" ".github/paths-filter.yml"
sed -i "/$f/ s/$/ # Image : yes/" ".github/paths-filter.yml"
fi
fi
done
# Sort yaml
sort -t= ".github/paths-filter.yml" -o ".github/paths-filter.yml"
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
commit: -u
message: "GitHub bot : scripts executable"
default_author: github_actions
check-addon-changes:
runs-on: ubuntu-latest
needs: [correct_path_filters]
outputs:
changedAddons: ${{ steps.filter.outputs.changes }}
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: 📂 Detect changed files
uses: dorny/paths-filter@v3
id: filter
with:
filters: .github/paths-filter.yml
correct-CRLF:
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
needs: check-addon-changes
uses: ./.github/workflows/weekly_crlftolf.yaml
make-executable:
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
needs: [check-addon-changes, correct-CRLF]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Make scripts executable
run: |
echo "Starting"
git pull origin master
git config core.filemode true
# shellcheck disable=SC2086,SC2046
#git update-index --chmod=+x $(find "$path" -type f -iname "*.sh")
chmod u+x $(find "$path" -type f -iname "*.sh") || true
#git commit -am "fixing the script permissions..."
env:
path: "./${{ matrix.addon }}"
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
commit: -u
message: "GitHub bot : scripts executable"
default_author: github_actions
lint_config:
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
needs: check-addon-changes
runs-on: ubuntu-latest
strategy:
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
steps:
- name: ↩️ Checkout
uses: actions/checkout@v4
- name: 🔎 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2
with:
path: "./${{ matrix.addon }}"
build:
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
needs: [check-addon-changes, make-executable, correct-CRLF]
runs-on: ubuntu-latest
environment: CR_PAT
name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on
strategy:
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
arch: ["aarch64", "amd64", "armv7"]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
with:
path: "./${{ matrix.addon }}"
- name: Check if add-on should be built
id: check
env:
HEAD: "${{ github.head_ref }}"
run: |
# shellcheck disable=SC2157,SC2086
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
# shellcheck disable=SC2129
echo "build_arch=true" >> $GITHUB_OUTPUT;
# shellcheck disable=SC2129
echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT;
if [[ -z "$HEAD" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
# shellcheck disable=SC2129
echo "BUILD_ARGS=" >> $GITHUB_ENV;
fi
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
# shellcheck disable=SC2129
echo "build_arch=false" >> $GITHUB_OUTPUT;
fi
- name: Use action to check for mixed line endings (CRLF and LF)
uses: ymwymw/check-mixed-line-endings@v2
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/login-action@v3.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build ${{ matrix.addon }} add-on
id: builderstep
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@master
env:
CAS_API_KEY: ${{ secrets.CAS_API_KEY }}
with:
args: |
${{ env.BUILD_ARGS }} \
--${{ matrix.arch }} \
--target /data/${{ matrix.addon }} \
--image "${{ steps.check.outputs.image }}" \
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
--addon
make-changelog:
if: ${{ needs.check-addon-changes.outputs.changedAddons != '[]' }}
needs: [check-addon-changes, build]
runs-on: ubuntu-latest
strategy:
matrix:
addon: ${{ fromJSON(needs.check-addon-changes.outputs.changedAddons) }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Update changelog for minor versions
run: |
echo "Starting"
# Git pull
git pull || true
cd "$path"
# Get version
if [ -f config.yaml ]; then
version="$(sed -e '/version/!d' -e 's/.*version: //' config.yaml)"
elif [ -f config.json ]; then
version="$(sed -e '/version/!d' -e 's/.*[^"]*"\([^"]*\)"/\1/' config.json)"
version="${version//,}"
else
exit 1
fi
# Exit if test
if [[ "$version" == *"test"* ]]; then exit 0; fi
# Create changelog
touch CHANGELOG.md
# If the version does not exist
if ! grep -q "$version" CHANGELOG.md; then
first_line="$(sed -n '/./p' CHANGELOG.md | head -n 1)"
# If the first line does not start with -
if [[ "$first_line" != "-"* ]]; then
sed -i "1i\- Minor bugs fixed" CHANGELOG.md
fi
sed -i "1i\## $version ($(date '+%d-%m-%Y'))" CHANGELOG.md
#fi
fi
env:
path: "./${{ matrix.addon }}"
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
commit: -u
message: "GitHub bot : changelog"
default_author: github_actions
fetch: --force
push: --force

View File

@@ -0,0 +1,32 @@
# This workflow executes several linters on changed files based on languages used in your code base whenever
# you push a code or open a pull request.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/github/super-linter
---
name: Lint On Change
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
run-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Lint Code Base
uses: docker://github/super-linter:slim-v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_NATURAL_LANGUAGE: false

View File

@@ -1,54 +0,0 @@
---
name: Repository Updater
# yamllint disable-line rule:truthy
on:
repository_dispatch:
types: ["update"]
jobs:
publish:
name: Publish add-on update
runs-on: ubuntu-latest
steps:
- name: 🚀 Run Repository Updater
uses: hassio-addons/repository-updater@v1.1
with:
addon: ${{ github.event.client_payload.addon }}
repository: ${{ github.repository }}
token: ${{ secrets.UPDATER_TOKEN }}
announce:
name: Announce add-on update
needs: publish
runs-on: ubuntu-latest
steps:
- name: 📢 Announce on Discord server
uses: sarisia/actions-status-discord@v1.8.6
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
username: ${{ github.event.client_payload.name }}
avatar_url: |
https://raw.githubusercontent.com/${{ github.repository }}/master/${{ github.event.client_payload.addon }}/icon.png
title: ":arrow_up: ${{ github.event.client_payload.name }} ${{ github.event.client_payload.version }}"
image: |
https://raw.githubusercontent.com/${{ github.repository }}/master/${{ github.event.client_payload.addon }}/logo.png
description: |
A new version of the ${{ github.event.client_payload.name }} add-on has been published.
**Version**: `${{ github.event.client_payload.version }}`
**Release notes**:
<https://github.com/${{ github.event.client_payload.repository }}/releases/tag/${{ github.event.client_payload.version }}>
- name: 📢 Announce on Twitter
uses: devigned/go-twitter-action@v1.0.2
with:
apiKey: ${{ secrets.TWITTER_API_KEY }}
apiKeySecret: ${{ secrets.TWITTER_API_SECRET }}
accessToken: ${{ secrets.TWITTER_ACCESS_TOKEN }}
accessTokenSecret: ${{ secrets.TWITTER_ACCESS_SECRET }}
message: |
⬆️ ${{ github.event.client_payload.name }} ${{ github.event.client_payload.version }}
https://github.com/${{ github.event.client_payload.repository }}/releases/tag/${{ github.event.client_payload.version }}

View File

@@ -1,40 +0,0 @@
---
name: Stale
# yamllint disable-line rule:truthy
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
jobs:
stale:
name: 🧹 Clean up stale issues and PRs
runs-on: ubuntu-latest
steps:
- name: 🚀 Run stale
uses: actions/stale@v3.0.19
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 30
days-before-close: 7
remove-stale-when-updated: true
stale-issue-label: "stale"
exempt-issue-labels: "no-stale,help-wanted"
stale-issue-message: >
There hasn't been any activity on this issue recently, so we
clean up some of the older and inactive issues.
Please make sure to update to the latest version and
check if that solves the issue. Let us know if that works for you
by leaving a comment 👍
This issue has now been marked as stale and will be closed if no
further activity occurs. Thanks!
stale-pr-label: "stale"
exempt-pr-labels: "no-stale"
stale-pr-message: >
There hasn't been any activity on this pull request recently. This
pull request has been automatically marked as stale because of that
and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

View File

@@ -1,75 +0,0 @@
---
name: Translations Download
# yamllint disable-line rule:truthy
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
workflow_run:
workflows: ["Translations Upload"]
branches: [master]
types:
- completed
jobs:
json:
name: Download Translations
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- name: 🏗 Set up yq
uses: frenck/action-setup-yq@v1.0.0
- name: 🏗 Set up the Lokalise CLI
uses: frenck/action-setup-lokalise@v1.0.0
- name: ⤵️ Download translations
run: |
echo "Downloading translations to lokalise"
lokalise2 file download \
--token "${LOKALISE_TOKEN}" \
--project-id "${LOKALISE_PROJECT}" \
--format yaml \
--original-filenames=false \
--export-empty-as base \
--bundle-structure ".translations/%LANG_ISO%.yaml"
env:
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
LOKALISE_PROJECT: ${{ secrets.LOKALISE_PROJECT }}
- name: 🚀 Process translations
run: |
addons=$(yq e '.addons | keys | .[]' .addons.yml)
mkdir -p .translations
for file in .translations/*.yaml;
do
filename=$(basename "${file}")
language="${filename%.*}"
if [[ "${language}" == "en" ]]; then
continue
fi
echo "Processing downloaded translations in ${language}..."
while read addon;
do
if [[ -f "${addon}/translations/en.yaml" ]];
then
echo "Processing downloaded translations in ${language} for ${addon}..."
yq e ".${addon}" "${file}" \
> "${addon}/translations/${filename}"
fi
done <<<"${addons}"
done
- name: 🚀 Commit changes
continue-on-error: true
run: |
git config --local user.email "action@github.com"
git config --local user.name "${GITHUB_ACTOR}"
git add .
git commit -m "🌍 Updating translations" -a
- name: 🚀 Push changes
uses: ad-m/github-push-action@v0.6.0
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

View File

@@ -1,53 +0,0 @@
---
name: Translations Upload
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
workflow_run:
workflows: ["Repository Updater"]
branches: [master]
types:
- completed
jobs:
upload:
name: Upload Translations
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v2.3.4
- name: 🏗 Set up yq
uses: frenck/action-setup-yq@v1.0.0
- name: 🏗 Set up the Lokalise CLI
uses: frenck/action-setup-lokalise@v1.0.0
- name: 🚀 Combine translations
run: |
addons=$(yq e '.addons | keys | .[]' .addons.yml)
mkdir -p .translations
while read addon;
do
if [[ -f "${addon}/translations/en.yaml" ]];
then
echo "Prepping translation upload for $addon..."
ADDON="${addon}" \
yq e '{env(ADDON): .}' "${addon}/translations/en.yaml" \
> ".translations/${addon}.yaml"
fi
done <<<"${addons}"
echo "Combining translation files..."
yq ea '. as $item ireduce ({}; . * $item)' ./.translations/*.yaml > translations.yaml
- name: 🚀 Upload translations
run: |
echo "Uploading translations to lokalise"
lokalise2 file upload \
--apply-tm \
--lang-iso en \
--poll \
--token "${LOKALISE_TOKEN}" \
--project-id "${LOKALISE_PROJECT}" \
--file translations.yaml
env:
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
LOKALISE_PROJECT: ${{ secrets.LOKALISE_PROJECT }}

View File

@@ -0,0 +1,76 @@
# This workflow executes several linters on changed files based on languages used in your code base whenever
# you push a code or open a pull request.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/github/super-linter
---
name: Lint Code Base
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
make-executable:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Make scripts executable
run: |
echo "Starting"
git config core.filemode true
# shellcheck disable=SC2086,SC2046
#git update-index --chmod=+x $(find . -type f -iname "*.sh")
chmod u+x $(find . -type f -iname "*.sh")
#git commit -am "fixing the script permissions..."
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
commit: -u
message: "GitHub bot : scripts executable"
default_author: github_actions
run-lint:
runs-on: ubuntu-latest
needs: make-executable
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout the code base
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
####################
# Run Super Linter #
####################
- name: Lint Code Base
uses: docker://github/super-linter:slim-v4
env:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_NATURAL_LANGUAGE: false
ACTION_ACTIONLINT_DISABLE_ERRORS: true
check_crlf:
name: Check CRLF action
runs-on: ubuntu-latest
steps:
- name: Checkout repository contents
uses: actions/checkout@v4
- name: Use action to check for CRLF endings
uses: erclu/check-crlf@v1.2.0
- name: check-mixed-line-endings
uses: ymwymw/check-mixed-line-endings@v2

36
.github/workflows/weekly_addons_updater vendored Normal file
View File

@@ -0,0 +1,36 @@
# yamllint disable rule:line-length
---
name: Weekly addons update
on:
workflow_call:
workflow_dispatch:
jobs:
stats_graphs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install bashio
run: |
# Install bashio
if grep -q -rnw "$files/" -e 'bashio' && [ ! -f "/usr/bin/bashio" ]; then
[ "$VERBOSE" = true ] && echo "install bashio"
BASHIO_VERSION="0.14.3"
mkdir -p /tmp/bashio
curl -f -L -s -S "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" | tar -xzf - --strip 1 -C /tmp/bashio
mv /tmp/bashio/lib /usr/lib/bashio
ln -s /usr/lib/bashio/bashio /usr/bin/bashio
rm -rf /tmp/bashio
fi
- name: Run script
run: |
mkdir -p /data
echo "{" >> /data/config.json
echo " repository=\"Mesteriis/hassio-addons-avm\"," >> /data/config.json
echo " gituser=\"Mesteriis/hassio-addons-avm\"," >> /data/config.json
echo " gitapi=\"Mesteriis/hassio-addons-avm\"," >> /data/config.json
echo " gitmail=\"Mesteriis/hassio-addons-avm\"," >> /data/config.json
echo " verbose=false" >> /data/config.json
echo "}" >> /data/config.json
./addons_updater/rootfs/etc/cont-init.d/99-run.sh

View File

@@ -0,0 +1,43 @@
name: Weekly bash beautify
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
concurrency:
group: lint-bash-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
lint-bash:
name: Lint Bash Scripts
runs-on: ubuntu-latest
steps:
- name: Checkout Git Repository
uses: actions/checkout@v4
- name: Set up Python Environment
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Beautysh
run: pip install beautysh
- name: Run Beautysh
run: |
find . -name '*.sh' -print0 | xargs -0 beautysh --indent-size 4
shopt -s globstar nullglob
if compgen -G "**/*.sh" > /dev/null; then
beautysh -- **/*.sh --indent-size 4 --check
fi
shopt -u globstar nullglob
- name: Create New Pull Request If Needed
uses: peter-evans/create-pull-request@v5
with:
title: "Github bot : script beautyshied"
branch-suffix: timestamp
commit-message: "Github bot : script beautyshied"

54
.github/workflows/weekly_crlftolf.yaml vendored Normal file
View File

@@ -0,0 +1,54 @@
# yamllint disable rule:line-length
---
# This workflow finds and fixes CRLF endings in a repository
name: Fix CRLF Endings
on:
workflow_call:
workflow_dispatch:
jobs:
crlf-to-lf:
runs-on: ubuntu-latest
steps:
- name: Checkout repository contents
uses: actions/checkout@v4
- name: Use action to check for CRLF endings
uses: erclu/check-crlf@v1
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
message: "Github bot : CRLF corrected"
default_author: github_actions
fix-crlf:
name: Fix CRLF Endings
runs-on: ubuntu-latest # Use a Linux runner
steps:
- name: Checkout repository contents
uses: actions/checkout@v4 # Use the checkout action
- name: Find files with CRLF endings
uses: erclu/check-crlf@v1.2.0 # Use the check-crlf action
id: check-crlf # Assign an id to this step
with:
# Specify the paths to check
path: |
./*
!.git
!*.png
!*.jpg
!*.bin
- name: Apply dos2unix to files with CRLF endings
run: |
# Loop through each file and apply dos2unix
# shellcheck disable=SC2043
for f in ${{ steps.check-crlf.outputs.files }}; do
# Apply dos2unix and keep the original timestamp
dos2unix -k "$f"
done
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
message: "Github bot : CRLF corrected"
default_author: github_actions

View File

@@ -0,0 +1,37 @@
# Compress images on demand (workflow_dispatch), and at 11pm every Sunday (schedule).
# Open a Pull Request if any images can be compressed.
---
name: Compress Images
on:
workflow_dispatch:
schedule:
- cron: '00 23 * * 0'
jobs:
calibre:
name: calibreapp/image-actions
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Compress Images
id: calibre
uses: calibreapp/image-actions@main
with:
# The `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action cant update Pull Requests initiated from forked repositories.
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions
githubToken: ${{ secrets.GITHUB_TOKEN }}
compressOnly: true
jpegQuality: '60'
jpegProgressive: false
pngQuality: '60'
webpQuality: '60'
- name: Commit if needed
if: steps.calibre.outputs.markdown != ''
uses: EndBug/add-and-commit@v9
with:
message: "Github bot : image compressed"
default_author: github_actions
body: ${{ steps.calibre.outputs.markdown }}

31
.github/workflows/weekly_sortjson.yaml vendored Normal file
View File

@@ -0,0 +1,31 @@
# yamllint disable rule:line-length
---
name: Weekly sort json
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
sort_json:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Run script file
id: sort
run: |
for files in */*.json; do
echo "Sorting $files"
jq --sort-keys . "$files" > config2.json && cat config2.json > "$files" && rm config2.json
echo "changed=1" >> "$GITHUB_OUTPUT"
done
shell: bash
- name: Create New Pull Request If Needed
if: steps.sort.outputs.changed != ''
uses: peter-evans/create-pull-request@v5
with:
title: "Github bot : json sorted"
branch-suffix: timestamp
commit-message: "Github bot : json sorted"

106
.github/workflows/weekly_stats.yaml vendored Normal file
View File

@@ -0,0 +1,106 @@
# yamllint disable rule:line-length
---
name: Generate weekly stats
on:
schedule:
- cron: "0 12 * * 5"
workflow_dispatch:
jobs:
stats_updater:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Create stats
run: |
echo "Starting"
COUNT=0
COUNT1=0
COUNT2=0
COUNT3=0
# Make sure file exists
file=Stats
touch "$file"
rm "$file"2
if ! grep -q "Date" "$file"; then
sed -i "1i Date" "$file"
fi
# Add new column
sed -i 's/^/- /' "$file"
# Add date
sed -i "/Date/s|^-|$(date '+%Y-%m-%d')|" "$file"
# Go through all folders, add to filters if not existing
# shellcheck disable=SC2086
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do
DOWNLOADS=0
if [ -f "$f"/config.json ] && jq -e '.image' "$f/config.json"; then
SLUG="$(jq -r '.image' "$f/config.json" | awk -F 'alexbelgium/|-{arch' '{print $2}')"
if [[ "$(jq '.arch[]' "$f/config.json")" == *"armv7"* ]]; then
ARCH=armv7 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')"
until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done
COUNT="${COUNT//,/}"
COUNT1="$COUNT"
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
else COUNT1="-"; fi
if [[ "$(jq '.arch[]' "$f/config.json")" == *"amd64"* ]]; then
ARCH=amd64 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')"
until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done
COUNT="${COUNT//,/}"
COUNT2="$COUNT"
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
else COUNT2="-"; fi
if [[ "$(jq '.arch[]' "$f/config.json")" == *"aarch64"* ]]; then
ARCH=aarch64 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')"
until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done
COUNT="${COUNT//,/}"
COUNT3="$COUNT"
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
else COUNT3="-";fi
echo "$SLUG $DOWNLOADS $COUNT1 $COUNT2 $COUNT3" >> "$file"2
# Create line if not existing
if ! grep -q "${SLUG}$" "$file"; then
sed -i "\$a$SLUG" "$file"
# shellcheck disable=SC2046
for i in $(seq $(head -n 1 $file | tr -cd ' \t' | wc -c )); do
echo "$i"
sed -i "/$SLUG/s|^|- |" "$file"
done
fi
# Add data
sed -i "/${SLUG}$/s|^-|$DOWNLOADS|" "$file"
fi
done
# Add total
SLUG=TOTAL
if ! grep -q "$SLUG$" "$file"; then
sed -i "1a$SLUG" "$file"
# shellcheck disable=SC2046
for i in $(seq $(head -n 1 $file | tr -cd ' \t' | wc -c )); do
echo "$i"
sed -i "/$SLUG$/s|^|- |" "$file"
done
fi
DOWNLOADS="$(awk 'FNR > 2 {SUM+=$1}END{print SUM}' Stats)"
sed -i "/$SLUG$/s|^-|$DOWNLOADS|" "$file"
# Sort file
(head -n 2 "$file" && tail -n +3 "$file" | sort -k1 -r -n) > tmp && mv tmp "$file"
sed -i "1i Name Total armv7 amd64 aarch64" "$file"2
sed -i "1a ------------------------------" "$file"2
#TOTAL="$(awk '{SUM+=$2}END{print SUM}' Stats)"
#TOTAL1="$(awk '{SUM+=$2}END{print SUM}' Stats)"
#TOTAL2="$(awk '{SUM+=$2}END{print SUM}' Stats)"
#TOTAL3="$(awk '{SUM+=$2}END{print SUM}' Stats)"
- name: Commit if needed
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message : "Github bot : stats updated"
Generate_graphs:
needs: stats_updater
uses: ./.github/workflows/helper_stats_graphs.yaml