Skip to content

Commit 9e69c69

Browse files
authored
Merge branch 'main' into workflows-for-everyone
2 parents f1c6f27 + 1894976 commit 9e69c69

16 files changed

+431
-52
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 🙋‍♂️ Ask a question
2+
description: Tell us what's on your mind
3+
title: "[question]: "
4+
labels: ["question"]
5+
# assignees:
6+
# - OneSignal/ios-sdk
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: 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](https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/main/CONTRIBUTING.md)
25+
options:
26+
- label: I agree to follow this project's Code of Conduct
27+
required: true

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: 🪳 Bug report
2+
description: File a bug report
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
# assignees:
6+
# - OneSignal/ios-sdk
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: e.g. 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: input
42+
id: flutter-sdk-version
43+
attributes:
44+
label: OneSignal Flutter SDK version
45+
description: What version of the OneSignal Flutter SDK are you using?
46+
placeholder: Release 3.4.1
47+
validations:
48+
required: true
49+
- type: checkboxes
50+
id: platforms
51+
attributes:
52+
label: Which platform(s) are affected?
53+
description: Indicate which mobile platforms this issue is affecting
54+
options:
55+
- label: iOS
56+
required: false
57+
- label: Android
58+
required: false
59+
- type: textarea
60+
id: logs
61+
attributes:
62+
label: Relevant log output
63+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
64+
render: Shell
65+
- type: checkboxes
66+
id: terms
67+
attributes:
68+
label: Code of Conduct
69+
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/main/CONTRIBUTING.md)
70+
options:
71+
- label: I agree to follow this project's Code of Conduct
72+
required: true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 📣 General feedback
2+
description: Tell us what's on your mind
3+
title: "[Feedback]: "
4+
labels: ["triage"]
5+
# assignees:
6+
# - OneSignal/ios-sdk
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](https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/main/CONTRIBUTING.md)
25+
options:
26+
- label: I agree to follow this project's Code of Conduct
27+
required: true

.github/os_probot_metadata.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
}

.github/release-drafter.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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

.github/set_response_times.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
}

.github/workflows/Zapier.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
}'

.github/workflows/release-drafter.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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
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

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.onesignal.flutter'
2-
version '3.4.1'
2+
version '3.5.1'
33

44
buildscript {
55
repositories {
@@ -34,5 +34,5 @@ android {
3434
}
3535

3636
dependencies {
37-
api 'com.onesignal:OneSignal:4.8.2'
37+
api 'com.onesignal:OneSignal:4.8.5'
3838
}

0 commit comments

Comments
 (0)