onesignal-expo-plugin 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -36
- package/build/onesignal/withOneSignalAndroid.js +9 -15
- package/build/onesignal/withOneSignalIos.js +81 -47
- package/build/support/FileManager.js +22 -8
- package/build/support/NseUpdaterManager.js +8 -1
- package/build/support/eas/getEasManagedCredentialsConfigExtra.js +17 -17
- package/build/support/helpers.js +11 -7
- package/build/support/iosConstants.js +9 -5
- package/build/support/updatePodfile.js +3 -4
- package/build/types/types.js +9 -8
- package/package.json +19 -13
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -18
- package/.github/ISSUE_TEMPLATE/ask-question.yml +0 -50
- package/.github/ISSUE_TEMPLATE/bug-report.yml +0 -71
- package/.github/ISSUE_TEMPLATE/general-feedback.yml +0 -27
- package/.github/os_probot_metadata.js +0 -58
- package/.github/pull_request_template.md +0 -46
- package/.github/release-drafter.yml +0 -27
- package/.github/set_response_times.js +0 -47
- package/.github/workflows/Zapier.yml +0 -34
- package/.github/workflows/release-drafter.yml +0 -42
- package/.github/workflows/set_response_time.yml +0 -32
- package/CHANGELOG.md +0 -83
- package/EAS.md +0 -21
- package/IOS_CREDENTIALS_EAS.md +0 -170
- package/onesignal/withOneSignal.ts +0 -28
- package/onesignal/withOneSignalAndroid.ts +0 -147
- package/onesignal/withOneSignalIos.ts +0 -235
- package/support/FileManager.ts +0 -42
- package/support/NseUpdaterManager.ts +0 -40
- package/support/OneSignalLog.ts +0 -9
- package/support/eas/getEasManagedCredentialsConfigExtra.ts +0 -33
- package/support/helpers.ts +0 -41
- package/support/iosConstants.ts +0 -25
- package/support/serviceExtensionFiles/NotificationService.h +0 -8
- package/support/serviceExtensionFiles/NotificationService.m +0 -29
- package/support/serviceExtensionFiles/OneSignalNotificationServiceExtension-Info.plist +0 -31
- package/support/serviceExtensionFiles/OneSignalNotificationServiceExtension.entitlements +0 -10
- package/support/updatePodfile.ts +0 -19
- package/tsconfig.json +0 -16
- package/types/types.ts +0 -58
package/build/support/helpers.js
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePluginProps =
|
|
3
|
+
exports.validatePluginProps = validatePluginProps;
|
|
4
4
|
const types_1 = require("../types/types");
|
|
5
5
|
function validatePluginProps(props) {
|
|
6
6
|
// check the type of each property
|
|
7
|
-
if (typeof props.mode !==
|
|
7
|
+
if (typeof props.mode !== 'string') {
|
|
8
8
|
throw new Error("OneSignal Expo Plugin: 'mode' must be a string.");
|
|
9
9
|
}
|
|
10
|
-
if (props.devTeam && typeof props.devTeam !==
|
|
10
|
+
if (props.devTeam && typeof props.devTeam !== 'string') {
|
|
11
11
|
throw new Error("OneSignal Expo Plugin: 'devTeam' must be a string.");
|
|
12
12
|
}
|
|
13
|
-
if (props.iPhoneDeploymentTarget &&
|
|
13
|
+
if (props.iPhoneDeploymentTarget &&
|
|
14
|
+
typeof props.iPhoneDeploymentTarget !== 'string') {
|
|
14
15
|
throw new Error("OneSignal Expo Plugin: 'iPhoneDeploymentTarget' must be a string.");
|
|
15
16
|
}
|
|
16
17
|
if (props.smallIcons && !Array.isArray(props.smallIcons)) {
|
|
17
18
|
throw new Error("OneSignal Expo Plugin: 'smallIcons' must be an array.");
|
|
18
19
|
}
|
|
19
|
-
if (props.smallIconAccentColor &&
|
|
20
|
+
if (props.smallIconAccentColor &&
|
|
21
|
+
typeof props.smallIconAccentColor !== 'string') {
|
|
20
22
|
throw new Error("OneSignal Expo Plugin: 'smallIconAccentColor' must be a string.");
|
|
21
23
|
}
|
|
22
24
|
if (props.largeIcons && !Array.isArray(props.largeIcons)) {
|
|
23
25
|
throw new Error("OneSignal Expo Plugin: 'largeIcons' must be an array.");
|
|
24
26
|
}
|
|
25
|
-
if (props.iosNSEFilePath && typeof props.iosNSEFilePath !==
|
|
27
|
+
if (props.iosNSEFilePath && typeof props.iosNSEFilePath !== 'string') {
|
|
26
28
|
throw new Error("OneSignal Expo Plugin: 'iosNSEFilePath' must be a string.");
|
|
27
29
|
}
|
|
30
|
+
if (props.appGroupName && typeof props.appGroupName !== 'string') {
|
|
31
|
+
throw new Error("OneSignal Expo Plugin: 'appGroupName' must be a string.");
|
|
32
|
+
}
|
|
28
33
|
// check for extra properties
|
|
29
34
|
const inputProps = Object.keys(props);
|
|
30
35
|
for (const prop of inputProps) {
|
|
@@ -33,4 +38,3 @@ function validatePluginProps(props) {
|
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
|
-
exports.validatePluginProps = validatePluginProps;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NSE_EXT_FILES = exports.NSE_SOURCE_FILE = exports.NSE_TARGET_NAME = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.DEFAULT_BUNDLE_VERSION = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.NSE_PODFILE_REGEX = exports.NSE_PODFILE_SNIPPET = exports.TARGETED_DEVICE_FAMILY = exports.IPHONEOS_DEPLOYMENT_TARGET = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getAppGroupIdentifier = getAppGroupIdentifier;
|
|
5
|
+
exports.IPHONEOS_DEPLOYMENT_TARGET = '11.0';
|
|
5
6
|
exports.TARGETED_DEVICE_FAMILY = `"1,2"`;
|
|
6
7
|
exports.NSE_PODFILE_SNIPPET = `
|
|
7
8
|
target 'OneSignalNotificationServiceExtension' do
|
|
@@ -14,10 +15,13 @@ exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
|
|
|
14
15
|
exports.BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;
|
|
15
16
|
exports.DEFAULT_BUNDLE_VERSION = '1';
|
|
16
17
|
exports.DEFAULT_BUNDLE_SHORT_VERSION = '1.0';
|
|
17
|
-
exports.NSE_TARGET_NAME =
|
|
18
|
-
|
|
18
|
+
exports.NSE_TARGET_NAME = 'OneSignalNotificationServiceExtension';
|
|
19
|
+
function getAppGroupIdentifier(bundleIdentifier, customAppGroupName) {
|
|
20
|
+
return customAppGroupName ?? `group.${bundleIdentifier}.onesignal`;
|
|
21
|
+
}
|
|
22
|
+
exports.NSE_SOURCE_FILE = 'NotificationService.m';
|
|
19
23
|
exports.NSE_EXT_FILES = [
|
|
20
|
-
|
|
24
|
+
'NotificationService.h',
|
|
21
25
|
`${exports.NSE_TARGET_NAME}.entitlements`,
|
|
22
|
-
`${exports.NSE_TARGET_NAME}-Info.plist
|
|
26
|
+
`${exports.NSE_TARGET_NAME}-Info.plist`,
|
|
23
27
|
];
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.updatePodfile =
|
|
6
|
+
exports.updatePodfile = updatePodfile;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const iosConstants_1 = require("./iosConstants");
|
|
9
9
|
const OneSignalLog_1 = require("./OneSignalLog");
|
|
@@ -12,14 +12,13 @@ async function updatePodfile(iosPath) {
|
|
|
12
12
|
const podfile = await FileManager_1.FileManager.readFile(`${iosPath}/Podfile`);
|
|
13
13
|
const matches = podfile.match(iosConstants_1.NSE_PODFILE_REGEX);
|
|
14
14
|
if (matches) {
|
|
15
|
-
OneSignalLog_1.OneSignalLog.log(
|
|
15
|
+
OneSignalLog_1.OneSignalLog.log('OneSignalNotificationServiceExtension target already added to Podfile. Skipping...');
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
18
|
fs_1.default.appendFile(`${iosPath}/Podfile`, iosConstants_1.NSE_PODFILE_SNIPPET, (err) => {
|
|
19
19
|
if (err) {
|
|
20
|
-
OneSignalLog_1.OneSignalLog.error(
|
|
20
|
+
OneSignalLog_1.OneSignalLog.error('Error writing to Podfile');
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
exports.updatePodfile = updatePodfile;
|
package/build/types/types.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Mode = exports.ONESIGNAL_PLUGIN_PROPS = void 0;
|
|
4
4
|
exports.ONESIGNAL_PLUGIN_PROPS = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
'mode',
|
|
6
|
+
'devTeam',
|
|
7
|
+
'iPhoneDeploymentTarget',
|
|
8
|
+
'smallIcons',
|
|
9
|
+
'largeIcons',
|
|
10
|
+
'iosNSEFilePath',
|
|
11
|
+
'smallIconAccentColor',
|
|
12
|
+
'appGroupName',
|
|
12
13
|
];
|
|
13
14
|
var Mode;
|
|
14
15
|
(function (Mode) {
|
|
15
16
|
Mode["Dev"] = "development";
|
|
16
17
|
Mode["Prod"] = "production";
|
|
17
|
-
})(Mode
|
|
18
|
+
})(Mode || (exports.Mode = Mode = {}));
|
package/package.json
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onesignal-expo-plugin",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Some Changez",
|
|
5
5
|
"main": "./app.plugin.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"build",
|
|
8
|
+
"app.plugin.js"
|
|
9
|
+
],
|
|
6
10
|
"scripts": {
|
|
7
|
-
"test": "
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
+
"test": "bun test",
|
|
12
|
+
"test:coverage": "bun test --coverage",
|
|
13
|
+
"build": "bun run lint && rm -rf build && tsc && cp -a src/support/serviceExtensionFiles build/support/",
|
|
14
|
+
"format:check": "prettier --check \"**/*.{ts,tsx}\" --ignore-path .prettierignore",
|
|
15
|
+
"format:fix": "prettier --write \"**/*.{ts,tsx}\" --ignore-path .prettierignore",
|
|
16
|
+
"lint": "oxlint src examples && bun run format:check",
|
|
17
|
+
"lint:fix": "oxlint src examples --fix && bun run format:fix"
|
|
11
18
|
},
|
|
12
19
|
"repository": {
|
|
13
20
|
"type": "git",
|
|
@@ -34,14 +41,13 @@
|
|
|
34
41
|
},
|
|
35
42
|
"homepage": "https://github.com/OneSignal/onesignal-expo-plugin#readme",
|
|
36
43
|
"devDependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"typescript": "^4.5.5"
|
|
44
|
+
"@types/bun": "^1.3.9",
|
|
45
|
+
"expo-module-scripts": "^5.0.8",
|
|
46
|
+
"oxlint": "^1.43.0",
|
|
47
|
+
"prettier": "^3.8.1",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
43
49
|
},
|
|
44
50
|
"dependencies": {
|
|
45
|
-
"@expo/image-utils": "^0.
|
|
51
|
+
"@expo/image-utils": "^0.8.8"
|
|
46
52
|
}
|
|
47
53
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
parser: '@typescript-eslint/parser',
|
|
4
|
-
plugins: [
|
|
5
|
-
'@typescript-eslint',
|
|
6
|
-
],
|
|
7
|
-
parserOptions: {
|
|
8
|
-
project: "tsconfig.json",
|
|
9
|
-
},
|
|
10
|
-
extends: [
|
|
11
|
-
'eslint:recommended',
|
|
12
|
-
'plugin:@typescript-eslint/recommended',
|
|
13
|
-
],
|
|
14
|
-
rules: {
|
|
15
|
-
"@typescript-eslint/no-floating-promises": "error",
|
|
16
|
-
"no-extra-boolean-cast": "off"
|
|
17
|
-
}
|
|
18
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
name: 🙋♂️ Ask a question
|
|
2
|
-
description: Tell us what's on your mind
|
|
3
|
-
title: "[question]: "
|
|
4
|
-
labels: ["triage"]
|
|
5
|
-
# assignees:
|
|
6
|
-
# - assign your sdk team e.g., onesignal/unity
|
|
7
|
-
body:
|
|
8
|
-
- type: markdown
|
|
9
|
-
attributes:
|
|
10
|
-
value: |
|
|
11
|
-
Having issues integrating this SDK?
|
|
12
|
-
- type: textarea
|
|
13
|
-
id: question
|
|
14
|
-
attributes:
|
|
15
|
-
label: How can we help?
|
|
16
|
-
description: Specific question regarding integrating this SDK.
|
|
17
|
-
placeholder: How do I...?
|
|
18
|
-
validations:
|
|
19
|
-
required: true
|
|
20
|
-
- type: textarea
|
|
21
|
-
id: expo-sdk-version
|
|
22
|
-
attributes:
|
|
23
|
-
label: OneSignal Expo SDK version
|
|
24
|
-
description: The version of the OneSignal Expo SDK you have a question for.
|
|
25
|
-
placeholder: 1.0.0
|
|
26
|
-
validations:
|
|
27
|
-
required: true
|
|
28
|
-
- type: dropdown
|
|
29
|
-
id: platform
|
|
30
|
-
attributes:
|
|
31
|
-
label: Platform
|
|
32
|
-
description: Which platform are you having an issue with?
|
|
33
|
-
multiple: true
|
|
34
|
-
options:
|
|
35
|
-
- iOS
|
|
36
|
-
- Android
|
|
37
|
-
- type: textarea
|
|
38
|
-
id: logs
|
|
39
|
-
attributes:
|
|
40
|
-
label: Relevant log output
|
|
41
|
-
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
42
|
-
render: Shell
|
|
43
|
-
- type: checkboxes
|
|
44
|
-
id: terms
|
|
45
|
-
attributes:
|
|
46
|
-
label: Code of Conduct
|
|
47
|
-
description: By submitting this issue, you agree to follow our [Code of Conduct](#insert-project-code-of-conduct-here)
|
|
48
|
-
options:
|
|
49
|
-
- label: I agree to follow this project's Code of Conduct
|
|
50
|
-
required: true
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
name: 🪳 Bug Report
|
|
2
|
-
description: File a bug report
|
|
3
|
-
title: "[Bug]: "
|
|
4
|
-
labels: ["bug", "triage"]
|
|
5
|
-
# assignees:
|
|
6
|
-
# - assign your sdk team e.g., onesignal/unity
|
|
7
|
-
body:
|
|
8
|
-
- type: markdown
|
|
9
|
-
attributes:
|
|
10
|
-
value: |
|
|
11
|
-
Thanks for taking the time to fill out this bug report!
|
|
12
|
-
- type: textarea
|
|
13
|
-
id: what-happened
|
|
14
|
-
attributes:
|
|
15
|
-
label: What happened?
|
|
16
|
-
description: Provide a thorough description of whats going on.
|
|
17
|
-
placeholder: The latest version of the SDK causes my screen to go blank when I tap on the screen three times.
|
|
18
|
-
validations:
|
|
19
|
-
required: true
|
|
20
|
-
- type: textarea
|
|
21
|
-
id: reproduction-steps
|
|
22
|
-
attributes:
|
|
23
|
-
label: Steps to reproduce?
|
|
24
|
-
description: Provide as much detail as posible to reproduce the issue.
|
|
25
|
-
placeholder: |
|
|
26
|
-
1. Install vX.Y.Z of dependency
|
|
27
|
-
2. Launch the app on iOS device
|
|
28
|
-
3. Tap the screen three times
|
|
29
|
-
4. Note that the app crashes
|
|
30
|
-
render: Markdown
|
|
31
|
-
validations:
|
|
32
|
-
required: true
|
|
33
|
-
- type: textarea
|
|
34
|
-
id: what-are-expectations
|
|
35
|
-
attributes:
|
|
36
|
-
label: What did you expect to happen?
|
|
37
|
-
description: Also tell us, what did you expect to happen?
|
|
38
|
-
placeholder: I expected the app to continue running no matter how many times I tap the screen.
|
|
39
|
-
validations:
|
|
40
|
-
required: true
|
|
41
|
-
- type: textarea
|
|
42
|
-
id: expo-sdk-version
|
|
43
|
-
attributes:
|
|
44
|
-
label: OneSignal Expo SDK version
|
|
45
|
-
description: The version of the OneSignal Expo SDK used in your app.
|
|
46
|
-
placeholder: 1.0.0
|
|
47
|
-
validations:
|
|
48
|
-
required: true
|
|
49
|
-
- type: dropdown
|
|
50
|
-
id: platform
|
|
51
|
-
attributes:
|
|
52
|
-
label: Platform
|
|
53
|
-
description: Which platform are you having an issue with?
|
|
54
|
-
multiple: true
|
|
55
|
-
options:
|
|
56
|
-
- iOS
|
|
57
|
-
- Android
|
|
58
|
-
- type: textarea
|
|
59
|
-
id: logs
|
|
60
|
-
attributes:
|
|
61
|
-
label: Relevant log output
|
|
62
|
-
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
63
|
-
render: Shell
|
|
64
|
-
- type: checkboxes
|
|
65
|
-
id: terms
|
|
66
|
-
attributes:
|
|
67
|
-
label: Code of Conduct
|
|
68
|
-
description: By submitting this issue, you agree to follow our [Code of Conduct](#insert-project-code-of-conduct-here)
|
|
69
|
-
options:
|
|
70
|
-
- label: I agree to follow this project's Code of Conduct
|
|
71
|
-
required: true
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name: 📣 General feedback
|
|
2
|
-
description: Tell us what's on your mind
|
|
3
|
-
title: "[feedback]: "
|
|
4
|
-
labels: ["triage"]
|
|
5
|
-
# assignees:
|
|
6
|
-
# - assign your sdk team e.g., onesignal/unity
|
|
7
|
-
body:
|
|
8
|
-
- type: markdown
|
|
9
|
-
attributes:
|
|
10
|
-
value: |
|
|
11
|
-
Thanks for sharing your valuable feedback!
|
|
12
|
-
- type: textarea
|
|
13
|
-
id: feedback
|
|
14
|
-
attributes:
|
|
15
|
-
label: What's on your mind?
|
|
16
|
-
description: Feedback regarding this SDK.
|
|
17
|
-
placeholder: Share your feedback...
|
|
18
|
-
validations:
|
|
19
|
-
required: true
|
|
20
|
-
- type: checkboxes
|
|
21
|
-
id: terms
|
|
22
|
-
attributes:
|
|
23
|
-
label: Code of Conduct
|
|
24
|
-
description: By submitting this issue, you agree to follow our [Code of Conduct](#insert-project-code-of-conduct-here)
|
|
25
|
-
options:
|
|
26
|
-
- label: I agree to follow this project's Code of Conduct
|
|
27
|
-
required: true
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Based on probot-metadata - https://github.com/probot/metadata
|
|
3
|
-
*/
|
|
4
|
-
const regex = /\n\n<!-- probot = (.*) -->/
|
|
5
|
-
|
|
6
|
-
const { Octokit } = require("@octokit/action")
|
|
7
|
-
|
|
8
|
-
const octokit = new Octokit()
|
|
9
|
-
|
|
10
|
-
module.exports = (context, issue = null) => {
|
|
11
|
-
console.log(context)
|
|
12
|
-
const prefix = "onesignal-probot"
|
|
13
|
-
|
|
14
|
-
if (!issue) issue = context.payload.issue
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
async get (key = null) {
|
|
18
|
-
let body = issue.body
|
|
19
|
-
|
|
20
|
-
if (!body) {
|
|
21
|
-
body = (await octokit.issues.get(issue)).data.body || ''
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const match = body.match(regex)
|
|
25
|
-
|
|
26
|
-
if (match) {
|
|
27
|
-
const data = JSON.parse(match[1])[prefix]
|
|
28
|
-
return key ? data && data[key] : data
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
async set (key, value) {
|
|
33
|
-
let body = issue.body
|
|
34
|
-
let data = {}
|
|
35
|
-
|
|
36
|
-
if (!body) body = (await octokit.issues.get(issue)).data.body || ''
|
|
37
|
-
|
|
38
|
-
body = body.replace(regex, (_, json) => {
|
|
39
|
-
data = JSON.parse(json)
|
|
40
|
-
return ''
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
if (!data[prefix]) data[prefix] = {}
|
|
44
|
-
|
|
45
|
-
if (typeof key === 'object') {
|
|
46
|
-
Object.assign(data[prefix], key)
|
|
47
|
-
} else {
|
|
48
|
-
data[prefix][key] = value
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
body = `${body}\n\n<!-- probot = ${JSON.stringify(data)} -->`
|
|
52
|
-
|
|
53
|
-
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/")
|
|
54
|
-
const issue_number = context.payload.issue.number
|
|
55
|
-
return octokit.issues.update({ owner, repo, issue_number, body })
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<!-- START -->
|
|
2
|
-
# READ AND DELETE THIS SECTION BEFORE SUBMITTING PR
|
|
3
|
-
* **Fill out each _REQUIRED_ section**
|
|
4
|
-
* **Fill out _OPTIONAL_ sections, remove section if it doesn't apply to your PR**
|
|
5
|
-
* **Read and fill out each of the checklists below**
|
|
6
|
-
* **Remove this section after reading**
|
|
7
|
-
<!-- END -->
|
|
8
|
-
|
|
9
|
-
# Description
|
|
10
|
-
## One Line Summary
|
|
11
|
-
**REQUIRED** - Very short description that summaries the changes in this PR.
|
|
12
|
-
|
|
13
|
-
## Details
|
|
14
|
-
|
|
15
|
-
### Motivation
|
|
16
|
-
**REQUIRED -** Why is this code change being made? Or what is the goal of this PR? Examples: Fixes a specific bug, provides additional logging to debug future issues, feature to allow X.
|
|
17
|
-
|
|
18
|
-
### Scope
|
|
19
|
-
**RECOMMEND - OPTIONAL -** What is intended to be effected. What is known not to change. Example: Notifications are grouped when parameter X is set, not enabled by default.
|
|
20
|
-
|
|
21
|
-
### OPTIONAL - Other
|
|
22
|
-
**OPTIONAL -** Feel free to add any other sections or sub-sections that can explain your PR better.
|
|
23
|
-
|
|
24
|
-
# Testing
|
|
25
|
-
|
|
26
|
-
## Manual testing
|
|
27
|
-
**REQUIRED -** Explain what scenarios were tested and the environment.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# Checklist
|
|
31
|
-
## Overview
|
|
32
|
-
- [ ] I have filled out all **REQUIRED** sections above
|
|
33
|
-
- [ ] PR does one thing
|
|
34
|
-
- If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
|
|
35
|
-
- [ ] Any Public API changes are explained in the PR details and conform to existing APIs
|
|
36
|
-
|
|
37
|
-
## Testing
|
|
38
|
-
- [ ] I have personally tested this on my device, or explained why that is not possible
|
|
39
|
-
- [ ] I have tested this on the latest version of the plugin
|
|
40
|
-
- [ ] I have tested this on both Android and iOS, or explained why that is not possible
|
|
41
|
-
|
|
42
|
-
## Final pass
|
|
43
|
-
- [ ] Code is as readable as possible.
|
|
44
|
-
- Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
|
|
45
|
-
- [ ] I have reviewed this PR myself, ensuring it meets each checklist item
|
|
46
|
-
- WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name-template: $RESOLVED_VERSION
|
|
2
|
-
tag-template: $RESOLVED_VERSION
|
|
3
|
-
categories:
|
|
4
|
-
- title: 🚀 Features
|
|
5
|
-
label: Enhancement / Feature
|
|
6
|
-
- title: 🐛 Bug Fixes
|
|
7
|
-
label: Bug
|
|
8
|
-
- title: 🧰 Improvements
|
|
9
|
-
label: Improvement
|
|
10
|
-
- title: down arrow Dependency Updates
|
|
11
|
-
label: Dependencies
|
|
12
|
-
change-template: '- $TITLE (#$NUMBER)'
|
|
13
|
-
version-resolver:
|
|
14
|
-
major:
|
|
15
|
-
labels:
|
|
16
|
-
- 'major'
|
|
17
|
-
minor:
|
|
18
|
-
labels:
|
|
19
|
-
- 'minor'
|
|
20
|
-
patch:
|
|
21
|
-
labels:
|
|
22
|
-
- 'patch'
|
|
23
|
-
default: patch
|
|
24
|
-
template: |
|
|
25
|
-
## Other Changes
|
|
26
|
-
|
|
27
|
-
$CHANGES
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
function calcResponseTimeForIssueCreatedAt(createdAt) {
|
|
2
|
-
const issueOpenedDate = new Date(createdAt);
|
|
3
|
-
const issueTriagedDate = new Date();
|
|
4
|
-
const businessDaysResponseTime = calcBusinessDaysBetweenDates(issueOpenedDate, issueTriagedDate);
|
|
5
|
-
return businessDaysResponseTime;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function calcBusinessDaysBetweenDates(openedDate, triagedDate) {
|
|
9
|
-
let differenceInWeeks, responseTime;
|
|
10
|
-
if (triagedDate < openedDate)
|
|
11
|
-
return -1; // error code if dates transposed
|
|
12
|
-
let openedDay = openedDate.getDay(); // day of week
|
|
13
|
-
let triagedDay = triagedDate.getDay();
|
|
14
|
-
openedDay = (openedDay == 0) ? 7 : openedDay; // change Sunday from 0 to 7
|
|
15
|
-
triagedDay = (triagedDay == 0) ? 7 : triagedDay;
|
|
16
|
-
openedDay = (openedDay > 5) ? 5 : openedDay; // only count weekdays
|
|
17
|
-
triagedDay = (triagedDay > 5) ? 5 : triagedDay;
|
|
18
|
-
// calculate differnece in weeks (1000mS * 60sec * 60min * 24hrs * 7 days = 604800000)
|
|
19
|
-
differenceInWeeks = Math.floor((triagedDate.getTime() - openedDate.getTime()) / 604800000);
|
|
20
|
-
if (openedDay < triagedDay) { //Equal to makes it reduce 5 days
|
|
21
|
-
responseTime = (differenceInWeeks * 5) + (triagedDay - openedDay);
|
|
22
|
-
}
|
|
23
|
-
else if (openedDay == triagedDay) {
|
|
24
|
-
responseTime = differenceInWeeks * 5;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
responseTime = ((differenceInWeeks + 1) * 5) - (openedDay - triagedDay);
|
|
28
|
-
}
|
|
29
|
-
return (responseTime);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = async(context, osmetadata) => {
|
|
33
|
-
const foundResponseTime = await osmetadata(context).get('response_time_in_business_days');
|
|
34
|
-
if (foundResponseTime) {
|
|
35
|
-
const foundString = "already found response time in business days: " + foundResponseTime
|
|
36
|
-
console.log(foundString);
|
|
37
|
-
return foundString;
|
|
38
|
-
}
|
|
39
|
-
if (context.payload.comment && context.payload.comment.author_association != "MEMBER" && context.payload.comment.author_association != "OWNER" && context.payload.comment.author_association != "CONTRIBUTOR") {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const businessDaysResponseTime = calcResponseTimeForIssueCreatedAt(context.payload.issue.created_at);
|
|
43
|
-
console.log("response time in business days: " + businessDaysResponseTime);
|
|
44
|
-
const result = osmetadata(context, context.payload.issue).set('response_time_in_business_days', businessDaysResponseTime)
|
|
45
|
-
console.log("osmetadata update result: " + result);
|
|
46
|
-
return "set response time in business days: " + businessDaysResponseTime;
|
|
47
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# This is an action to close asana tasks that were generated by Github issues
|
|
2
|
-
|
|
3
|
-
name: Zapier web hook
|
|
4
|
-
|
|
5
|
-
# Controls when the workflow will run
|
|
6
|
-
on:
|
|
7
|
-
# Triggers the workflow on push or pull request events but only for the "main" branch
|
|
8
|
-
issues:
|
|
9
|
-
types: [closed]
|
|
10
|
-
|
|
11
|
-
permissions:
|
|
12
|
-
issues: read
|
|
13
|
-
|
|
14
|
-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
15
|
-
jobs:
|
|
16
|
-
# This workflow contains a single job called "build"
|
|
17
|
-
build:
|
|
18
|
-
# The type of runner that the job will run on
|
|
19
|
-
runs-on: ubuntu-latest
|
|
20
|
-
|
|
21
|
-
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
22
|
-
steps:
|
|
23
|
-
# Runs a set of commands using the runners shell
|
|
24
|
-
- name: Call Zapier web hook to close Asana task
|
|
25
|
-
if: ${{ !github.event.issue.pull_request }}
|
|
26
|
-
env:
|
|
27
|
-
ISSUE_TITLE: ${{ github.event.issue.title }}
|
|
28
|
-
run: |
|
|
29
|
-
curl --location --request POST 'https://hooks.zapier.com/hooks/catch/12728683/b7009qc/' \
|
|
30
|
-
--header 'Content-Type: application/json' \
|
|
31
|
-
--header 'Accept: application/json' \
|
|
32
|
-
--data-raw '{
|
|
33
|
-
"task_name" : "$ISSUE_TITLE"
|
|
34
|
-
}'
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
name: Release Drafter
|
|
3
|
-
|
|
4
|
-
on:
|
|
5
|
-
push:
|
|
6
|
-
# branches to consider in the event; optional, defaults to all
|
|
7
|
-
branches:
|
|
8
|
-
- main
|
|
9
|
-
# pull_request event is required only for autolabeler
|
|
10
|
-
pull_request:
|
|
11
|
-
# Only following types are handled by the action, but one can default to all as well
|
|
12
|
-
types: [opened, reopened, synchronize]
|
|
13
|
-
# pull_request_target event is required for autolabeler to support PRs from forks
|
|
14
|
-
# pull_request_target:
|
|
15
|
-
# types: [opened, reopened, synchronize]
|
|
16
|
-
|
|
17
|
-
permissions:
|
|
18
|
-
contents: read
|
|
19
|
-
|
|
20
|
-
jobs:
|
|
21
|
-
update_release_draft:
|
|
22
|
-
permissions:
|
|
23
|
-
# write permission is required to create a github release
|
|
24
|
-
contents: write
|
|
25
|
-
# write permission is required for autolabeler
|
|
26
|
-
# otherwise, read permission is required at least
|
|
27
|
-
pull-requests: write
|
|
28
|
-
runs-on: ubuntu-latest
|
|
29
|
-
steps:
|
|
30
|
-
# (Optional) GitHub Enterprise requires GHE_HOST variable set
|
|
31
|
-
#- name: Set GHE_HOST
|
|
32
|
-
# run: |
|
|
33
|
-
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
|
|
34
|
-
|
|
35
|
-
# Drafts your next Release notes as Pull Requests are merged into "master"
|
|
36
|
-
- uses: release-drafter/release-drafter@v5
|
|
37
|
-
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
|
|
38
|
-
# with:
|
|
39
|
-
# config-name: my-config.yml
|
|
40
|
-
# disable-autolabeler: true
|
|
41
|
-
env:
|
|
42
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: Set Response Time
|
|
2
|
-
on:
|
|
3
|
-
issue_comment:
|
|
4
|
-
types:
|
|
5
|
-
- created
|
|
6
|
-
issues:
|
|
7
|
-
types:
|
|
8
|
-
- closed
|
|
9
|
-
jobs:
|
|
10
|
-
calculate:
|
|
11
|
-
name: set reponse time for the issue
|
|
12
|
-
if: github.event.issue.pull_request == null
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
permissions:
|
|
15
|
-
issues: write
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v3
|
|
18
|
-
with:
|
|
19
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
-
- run: npm install @octokit/action@6.0.6
|
|
21
|
-
- uses: actions/github-script@v6
|
|
22
|
-
id: set-time
|
|
23
|
-
with:
|
|
24
|
-
result-encoding: string
|
|
25
|
-
script: |
|
|
26
|
-
const os_probot_metadata = require('./.github/os_probot_metadata.js')
|
|
27
|
-
const set_response_time = require('./.github/set_response_times.js')
|
|
28
|
-
return await set_response_time(context, os_probot_metadata)
|
|
29
|
-
env:
|
|
30
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
31
|
-
- name: Get result
|
|
32
|
-
run: echo "${{steps.set-time.outputs.result}}" >> $GITHUB_STEP_SUMMARY
|