Skip to content

Commit 13569bc

Browse files
fix: location
1 parent 8e1333c commit 13569bc

File tree

3 files changed

+45
-20
lines changed

3 files changed

+45
-20
lines changed

dist/index.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98948,19 +98948,23 @@ var __webpack_exports__ = {}
9894898948
}
9894998949
}
9895098950

98951-
if (locations && locations.length > 0) {
98952-
const locationLookup = locations.find((l) => l.id === location.id)
98953-
if (!locationLookup) {
98954-
event.location = location.text
98955-
} else {
98956-
event.location = locationLookup.name
98957-
if (locationLookup.geo) {
98958-
const [lat, lon] = locationLookup.geo
98959-
event.geo = { lat, lon }
98951+
if (location) {
98952+
if (locations && locations.length > 0) {
98953+
const locationLookup = locations.find((l) => l.id === location.id)
98954+
if (!locationLookup) {
98955+
event.location = location.text
98956+
} else {
98957+
event.location = locationLookup.name
98958+
if (locationLookup.geo) {
98959+
const [lat, lon] = locationLookup.geo
98960+
event.geo = { lat, lon }
98961+
}
9896098962
}
98963+
} else {
98964+
event.location = location.text ? location.text : ''
9896198965
}
9896298966
} else {
98963-
event.location = location.text ? location.text : ''
98967+
event.location = ''
9896498968
}
9896598969

9896698970
events.push(event)

e2e/realworld.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import github from '@actions/github'
2+
import { createIcs } from '../src/create-ics.js'
3+
import { fetchIssues } from '../src/fetch-issues.js'
4+
5+
async function run() {
6+
const repoToken = process.env.GH_TOKEN
7+
const locationsFile = 'locations.json'
8+
const timeZone = 'America/Denver'
9+
10+
const octokit = github.getOctokit(repoToken)
11+
12+
const events = await fetchIssues(octokit, locationsFile, timeZone)
13+
14+
await createIcs(events)
15+
}
16+
17+
run()

src/fetch-issues.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,23 @@ export async function fetchIssues(
134134
}
135135
}
136136

137-
if (locations && locations.length > 0) {
138-
const locationLookup = locations.find((l) => l.id === location.id)
139-
if (!locationLookup) {
140-
event.location = location.text
141-
} else {
142-
event.location = locationLookup.name
143-
if (locationLookup.geo) {
144-
const [lat, lon] = locationLookup.geo
145-
event.geo = { lat, lon }
137+
if (location) {
138+
if (locations && locations.length > 0) {
139+
const locationLookup = locations.find((l) => l.id === location.id)
140+
if (!locationLookup) {
141+
event.location = location.text
142+
} else {
143+
event.location = locationLookup.name
144+
if (locationLookup.geo) {
145+
const [lat, lon] = locationLookup.geo
146+
event.geo = { lat, lon }
147+
}
146148
}
149+
} else {
150+
event.location = location.text ? location.text : ''
147151
}
148152
} else {
149-
event.location = location.text ? location.text : ''
153+
event.location = ''
150154
}
151155

152156
events.push(event)

0 commit comments

Comments
 (0)