Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit 6673d83

Browse files
authored
Add workflows (#68)
1 parent ded3122 commit 6673d83

File tree

10 files changed

+137
-27
lines changed

10 files changed

+137
-27
lines changed

.github/release-drafter.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
change-template: '- #$NUMBER $TITLE @$AUTHOR'
2+
sort-direction: ascending
3+
exclude-labels:
4+
- "release-drafter-ignore"
5+
template: |
6+
## What’s Changed
7+
8+
$CHANGES

.github/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository:
44
has_projects: false
55
has_wiki: false
66
has_downloads: false
7-
default_branch: master
7+
default_branch: main
88
allow_squash_merge: true
99
allow_merge_commit: false
1010
allow_rebase_merge: false

.github/stale.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
black:
13+
name: Black
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 📥 Checkout the repository
17+
uses: actions/checkout@v2
18+
19+
- name: ⬛ Run Black
20+
uses: psf/black@stable

.github/workflows/release-drafter.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release-drafter:
10+
name: Release Drafter
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: 📥 Checkout the repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: ⏭️ Get next version
19+
id: version
20+
run: |
21+
declare -i newpost
22+
latest=$(git describe --tags $(git rev-list --tags --max-count=1))
23+
latestpre=$(echo "$latest" | awk '{split($0,a,"."); print a[1] "." a[2]}')
24+
datepre=$(date --utc '+%y.%-m')
25+
if [[ "$latestpre" == "$datepre" ]]; then
26+
latestpost=$(echo "$latest" | awk '{split($0,a,"."); print a[3]}')
27+
newpost=$latestpost+1
28+
else
29+
newpost=0
30+
fi
31+
echo Current version: $latest
32+
echo New target version: $datepre.$newpost
33+
echo "::set-output name=version::$datepre.$newpost"
34+
35+
- name: 🏃 Run Release Drafter
36+
uses: release-drafter/release-drafter@v5
37+
with:
38+
tag: ${{ steps.version.outputs.version }}
39+
name: ${{ steps.version.outputs.version }}
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/validate.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Validate
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: "0 0 * * *"
12+
13+
jobs:
14+
validate-hassfest:
15+
runs-on: ubuntu-latest
16+
name: With hassfest
17+
steps:
18+
- name: 📥 Checkout the repository
19+
uses: actions/checkout@v2
20+
21+
- name: ✅ Hassfest validation
22+
uses: "home-assistant/actions/hassfest@master"
23+
24+
validate-hacs:
25+
runs-on: ubuntu-latest
26+
name: With HACS Action
27+
steps:
28+
- name: 📥 Checkout the repository
29+
uses: actions/checkout@v2
30+
31+
- name: ✅ HACS validation
32+
uses: hacs/action@main
33+
with:
34+
category: integration
35+
comment: false
36+
ignore: brands wheels

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) 2018-2020 Joakim Sørensen @ludeeus
3+
Copyright (c) 2018-2021 Joakim Sørensen @ludeeus
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

custom_components/authenticated/manifest.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"name": "Authenticated",
44
"version": "v0.0.0",
55
"documentation": "https://github.com/custom-components/authenticated",
6-
"dependencies": [],
7-
"codeowners": ["@ludeeus"],
8-
"requirements": []
9-
}
6+
"issue_tracker": "https://github.com/custom-components/authenticated/issues",
7+
"codeowners": [
8+
"@ludeeus"
9+
]
10+
}

custom_components/authenticated/sensor.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818
from homeassistant.helpers.entity import Entity
1919

2020
from .providers import PROVIDERS
21-
from .const import OUTFILE, CONF_NOTIFY, CONF_EXCLUDE, CONF_EXCLUDE_CLIENTS, CONF_PROVIDER, CONF_LOG_LOCATION, STARTUP
21+
from .const import (
22+
OUTFILE,
23+
CONF_NOTIFY,
24+
CONF_EXCLUDE,
25+
CONF_EXCLUDE_CLIENTS,
26+
CONF_PROVIDER,
27+
CONF_LOG_LOCATION,
28+
STARTUP,
29+
)
2230

2331
_LOGGER = logging.getLogger(__name__)
2432

@@ -42,7 +50,9 @@
4250
vol.Optional(CONF_LOG_LOCATION, default=""): cv.string,
4351
vol.Optional(CONF_NOTIFY, default=True): cv.boolean,
4452
vol.Optional(CONF_EXCLUDE, default=[]): vol.All(cv.ensure_list, [cv.string]),
45-
vol.Optional(CONF_EXCLUDE_CLIENTS, default=[]): vol.All(cv.ensure_list, [cv.string]),
53+
vol.Optional(CONF_EXCLUDE_CLIENTS, default=[]): vol.All(
54+
cv.ensure_list, [cv.string]
55+
),
4656
}
4757
)
4858

@@ -62,12 +72,16 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
6272
exclude_clients = config.get(CONF_EXCLUDE_CLIENTS)
6373
hass.data[PLATFORM_NAME] = {}
6474

65-
if not load_authentications(hass.config.path(".storage/auth"), exclude, exclude_clients):
75+
if not load_authentications(
76+
hass.config.path(".storage/auth"), exclude, exclude_clients
77+
):
6678
return False
6779

6880
out = str(hass.config.path(OUTFILE))
6981

70-
sensor = AuthenticatedSensor(hass, notify, out, exclude, exclude_clients, config[CONF_PROVIDER])
82+
sensor = AuthenticatedSensor(
83+
hass, notify, out, exclude, exclude_clients, config[CONF_PROVIDER]
84+
)
7185
sensor.initial_run()
7286

7387
add_devices([sensor], True)

hacs.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "Authenticated",
3+
"zip_release": true,
4+
"hide_default_branch": true,
5+
"filename": "authenticated.zip",
6+
"domain": "authenticated"
7+
}

0 commit comments

Comments
 (0)