Skip to content

Commit 084183a

Browse files
committed
Update GetActionItems to look at only Wednesday
1 parent 40d7c0f commit 084183a

File tree

2 files changed

+54
-14
lines changed

2 files changed

+54
-14
lines changed

dist/index.js

Lines changed: 25 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actionItems.ts

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ export async function GetActionItems(): Promise<string> {
1212
`g`
1313
)
1414
const allMeetingNotes = core.getInput('rootURLMeetingLogs')
15-
const sevenDaysAgo: string = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)
16-
.toISOString()
17-
.split('T')[0]
18-
const meetingNotesURL = allMeetingNotes + sevenDaysAgo + `/`
15+
16+
// Find the most recent Wednesday (meetings are always on Wednesdays)
17+
const mostRecentWednesday = getMostRecentWednesday()
18+
const meetingDate = mostRecentWednesday.toISOString().split('T')[0]
19+
20+
console.log(`Looking for meeting on Wednesday: ${meetingDate}`)
21+
const meetingNotesURL = allMeetingNotes + meetingDate + `/`
1922
const listOfMeetings = await fetchData(meetingNotesURL)
2023
const matches = listOfMeetings.match(meetingListRegEx)
2124

@@ -62,3 +65,25 @@ async function fetchData(url: string): Promise<string> {
6265
await axios(options)
6366
).data
6467
}
68+
69+
function getMostRecentWednesday(): Date {
70+
const today = new Date()
71+
const dayOfWeek = today.getDay() // 0 = Sunday, 3 = Wednesday
72+
73+
// If today is Wednesday (3), use today
74+
// Otherwise, go back to the most recent Wednesday
75+
let daysToSubtract = 0
76+
if (dayOfWeek === 3) {
77+
daysToSubtract = 0
78+
} else if (dayOfWeek > 3) {
79+
daysToSubtract = dayOfWeek - 3
80+
} else {
81+
daysToSubtract = dayOfWeek + 4
82+
}
83+
84+
const mostRecentWednesday = new Date(today)
85+
mostRecentWednesday.setDate(today.getDate() - daysToSubtract)
86+
mostRecentWednesday.setHours(0, 0, 0, 0) // Reset to midnight
87+
88+
return mostRecentWednesday
89+
}

0 commit comments

Comments
 (0)