Skip to content

Commit

Permalink
meeting-template: Add attendees function
Browse files Browse the repository at this point in the history
Fixes #77
  • Loading branch information
prestist committed Apr 18, 2024
1 parent 8c6bc88 commit dba3735
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 6 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
description: 'Where the meeting topic issues are found'
required: true
default: 'coreos/fedora-coreos-tracker'
peopleListURL:
description: 'People List for the roll call in the meeting'
required: true
default: 'https://raw.githubusercontent.com/coreos/fedora-coreos-tracker/main/meeting-people.txt'

runs:
using: node20
Expand Down
71 changes: 69 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions src/attendees.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as core from '@actions/core'
import axios from 'axios'

export async function GetAttendees(): Promise<string> {
try {
console.log(`GetAttendees started`)
// Fetch the attendees from the specified URL
const fetchedRollCall = await fetchData(core.getInput('peopleListURL'))
const peopleList = fetchedRollCall.split('\n').slice(2).join(' ')
console.log(peopleList)

return peopleList
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
return `Failed to get attendees. Check here https://github.com/coreos/fedora-coreos-tracker/blob/main/meeting-people.txt`
}
}

async function fetchData(url: string): Promise<string> {
const options = {
method: `GET`,
url
}
return (await axios(options)).data
}
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as core from '@actions/core'
import { GetActionItems } from './actionItems'
import { GetMeetingTopics } from './meetingTopics'
import { createThisReposIssue } from './createIssue'
import { GetAttendees } from './attendees'
import fs from 'fs'

/**
Expand All @@ -10,6 +11,9 @@ import fs from 'fs'
*/
export async function run(): Promise<void> {
try {
console.log('GetAttendees')
const attendees = await GetAttendees()

console.log('GetActionItems')
const actionItems = await GetActionItems()
console.log(actionItems)
Expand All @@ -18,7 +22,11 @@ export async function run(): Promise<void> {
const meetingTopics = await GetMeetingTopics()
console.log(meetingTopics)

const issueBody = hydrateIssueTemplate(actionItems, meetingTopics)
const issueBody = hydrateIssueTemplate(
attendees,
actionItems,
meetingTopics
)
console.log('Create issue')
createThisReposIssue(issueBody)
} catch (error) {
Expand All @@ -29,12 +37,14 @@ export async function run(): Promise<void> {

// read in templated issue body, and replace the placeholders with the actual content
function hydrateIssueTemplate(
attendees: string,
actionItems: string,
meetingTopics: string
): string {
// read in template file
const issueTemplate = fs.readFileSync('./static/meeting-template.md', 'utf8')
return issueTemplate
.replace('{{attendees}}', attendees)
.replace('{{action-items}}', actionItems)
.replace('{{meeting-topics}}', meetingTopics)
}
8 changes: 5 additions & 3 deletions static/meeting-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ At least 5 people must vote, or 51% of the WG membership, whichever is less. Vot
- [ ] Copy the following notification and post it

```text
@aaradhak:matrix.org @apiaseck:matrix.org @davdunc:fedora.im @dustymabe:matrix.org @guidon:guidon.ems.host @gurssing:matrix.org @jaimelm:fedora.im @jbrooks:matrix.org @jdoss:fedora.im @jlebon:fedora.im @jmarrero:matrix.org @lorbus:matrix.org @marmijo:fedora.im @miabbott:fedora.im @quentin9696:matrix.org @ravanelli:fedora.im @walters:fedora.im @ydesouza:fedora.im
FCOS community meeting in #fedora-meeting-1
If you don't want to be pinged remove your name from this file: https://github.com/coreos/fedora-coreos-tracker/blob/main/issue_template/meeting-template.md
{{attendees}}
FCOS community meeting in #meeting-1:fedoraproject.org If you don't want to be pinged remove your name from this file: https://github.com/coreos/fedora-coreos-tracker/blob/main/meeting-people.txt
```

3. Switch back to [#meeting-1:fedoraproject.org](https://matrix.to/#/#meeting-1:fedoraproject.org) wait for people to join
Expand Down

0 comments on commit dba3735

Please sign in to comment.