Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into production (#patch) #136

Merged
merged 12 commits into from
Nov 9, 2023
Merged
15 changes: 8 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,20 @@ on:
workflow_dispatch:
inputs:
versionBumpType:
description: 'Version bump (major, minor or patch)'
description: "Version bump (major, minor or patch)"
required: true

jobs:
deploy_to_npm:
name: Version Bump & Deploy to NPM

# Only run this job if initiator is not the Homey Github Actions Bot to prevent loops and check if if a version bump is provided and current branch is production or testing
if: github.actor != 'HomeyGithubActionsBot'
&& (github.ref == 'refs/heads/production' || github.ref == 'refs/heads/testing')
&& (github.event.inputs.versionBumpType == 'patch' || github.event.inputs.versionBumpType == 'minor' || github.event.inputs.versionBumpType == 'major' || contains(github.event.head_commit.message, '#patch') || contains(github.event.head_commit.message, '#minor') || contains(github.event.head_commit.message, '#major'))
if: github.actor != 'homey-bot'
&& (github.ref == 'refs/heads/production' || github.ref == 'refs/heads/testing')
&& (github.event.inputs.versionBumpType == 'patch' || github.event.inputs.versionBumpType == 'minor' || github.event.inputs.versionBumpType == 'major' || contains(github.event.head_commit.message, '#patch') || contains(github.event.head_commit.message, '#minor') || contains(github.event.head_commit.message, '#major'))

runs-on: ubuntu-latest
steps:

# Checks out the current repository.
- name: Checkout git repository
uses: actions/checkout@v2
Expand All @@ -58,15 +57,17 @@ jobs:
- name: Set up node 12 environment
uses: actions/setup-node@v1
with:
node-version: '12'
node-version: "12"
# Needed for publishing to npm
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"

# Run `npm ci && npm run build` to re-create your local environment (make sure to commit your - package-lock.json!).
- name: Build
run: |
npm ci
npm run build
env:
NODE_AUTH_TOKEN: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}

- name: Version bump patch
if: github.event.inputs.versionBumpType == 'patch' || contains(github.event.head_commit.message, '#patch') && !contains(github.event.head_commit.message, '#minor') && !contains(github.event.head_commit.message, '#major')
Expand Down
43 changes: 23 additions & 20 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,33 @@ name: Deploy Documentation To GitHub Pages

on:
push:
branches: [ production ]
branches: [production]
workflow_dispatch:

jobs:
deploy:
name: Build & Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '12'

# Build
- name: Build
run: |
npm ci
npm run build

# Deploy
- name: Deploy To GitHub Pages
uses: peaceiris/[email protected]
with:
personal_token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}
publish_dir: ./build
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: "12"
registry-url: https://npm.pkg.github.com

# Build
- name: Build
run: |
npm ci
npm run build
env:
NODE_AUTH_TOKEN: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}

# Deploy
- name: Deploy To GitHub Pages
uses: peaceiris/[email protected]
with:
personal_token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}
publish_dir: ./build
7 changes: 5 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:

# Checks out the current repository.
- uses: actions/checkout@v2

# Configures a Node.js environment.
- uses: actions/setup-node@v1
with:
node-version: '12'
node-version: "12"
registry-url: https://npm.pkg.github.com

# Run `npm ci` to re-create your local environment (make sure to commit your package-lock.json!).
# Finally run `npm run lint` (make sure you have defined a lint command in package.json e.g. "lint": "eslint .").
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}

- run: npm run lint
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }} # Important: use the matrix.node property when using a matrix strategy
registry-url: https://npm.pkg.github.com

# Run `npm ci` to re-create your local environment (make sure to commit your package-lock.json!).
# Finally run `npm test` (make sure you have defined a proper test command in package.json).
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}

- run: npm test
2 changes: 1 addition & 1 deletion docs/jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"opts": {
"simpleAnalyticsHost": "sa.athom.com",
"mainpagetitle": "Homey ZWaveDriver",
"template": "./node_modules/homey-jsdoc-template",
"template": "./node_modules/@athombv/jsdoc-template",
"readme": "./README.md",
"destination": "./build"
},
Expand Down
3 changes: 3 additions & 0 deletions lib/ZwaveDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@

// Non z-wave settings: see if there is a function to execute, otherwise do nothing.
if (typeof manifestSetting === 'undefined') {
if (this._settings.hasOwnProperty(changedKey)) {

Check warning on line 198 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 198 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
const parser = this._settings[changedKey];

if (typeof parser === 'function') parser.call(this, newValue);
Expand All @@ -212,7 +212,7 @@
id: changedKey,
index: manifestSetting.index,
size: manifestSetting.size,
signed: manifestSetting.hasOwnProperty('signed') ? manifestSetting.signed : true,

Check warning on line 215 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 215 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
},
newSettings[changedKey],
);
Expand Down Expand Up @@ -246,13 +246,13 @@

if (typeof message !== 'object' && typeof message !== 'string') {
this._debug("Save message's return value is not an object nor a string");
} else if (typeof message === 'object' && !message.hasOwnProperty('en')) {

Check warning on line 249 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 249 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
this._debug('A custom save message needs at least the english translation');
} else {
saveMessage = message;
}
} else if (typeof this.customSaveMessage === 'object') {
if (!this.customSaveMessage.hasOwnProperty('en')) {

Check warning on line 255 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 255 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
this._debug('A custom save message needs at least the english translation');
} else {
saveMessage = this.customSaveMessage;
Expand Down Expand Up @@ -871,7 +871,7 @@
if (command.name === 'CENTRAL_SCENE_NOTIFICATION') {
if (
typeof previousSequence !== 'undefined'
&& payload.hasOwnProperty('Sequence Number')

Check warning on line 874 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 874 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
&& payload['Sequence Number'] === previousSequence
) {
return;
Expand All @@ -879,8 +879,8 @@
previousSequence = payload['Sequence Number'];

if (
payload.hasOwnProperty('Properties1')

Check warning on line 882 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 882 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
&& payload.Properties1.hasOwnProperty('Key Attributes')

Check warning on line 883 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 883 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
&& typeof payload.Properties1['Key Attributes'] === 'number'
) {
switch (payload.Properties1['Key Attributes']) {
Expand Down Expand Up @@ -1058,9 +1058,12 @@
commandClassMeter = this.getCommandClass('METER');
}

if (commandClassMeter && commandClassMeter.hasOwnProperty('METER_RESET')) {

Check warning on line 1061 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 1061 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
const result = await commandClassMeter.METER_RESET({});
if (result !== 'TRANSMIT_COMPLETE_OK') throw result;

// Return if reset was successful
return;
}
throw new Error('missing_meter_reset_command');
}
Expand All @@ -1080,7 +1083,7 @@
* @returns {Promise<any>}
*/
async configurationSet(options = {}, value) {
if (!options.hasOwnProperty('index') && !options.hasOwnProperty('id')) {

Check warning on line 1086 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 1086 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 1086 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object

Check warning on line 1086 in lib/ZwaveDevice.js

View workflow job for this annotation

GitHub Actions / Lint

Do not access Object.prototype method 'hasOwnProperty' from target object
return Promise.reject(new Error('missing_setting_index_or_id'));
}
if (options.hasOwnProperty('index') && !options.hasOwnProperty('size')) {
Expand Down
Loading
Loading