Skip to content

Commit

Permalink
meeting-template: Add rollCall 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 d73cb3a
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 7 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
76 changes: 74 additions & 2 deletions dist/index.js

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

8 changes: 7 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 { GetRollCall } from './rollCall'
import fs from 'fs'

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

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

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

// read in templated issue body, and replace the placeholders with the actual content
function hydrateIssueTemplate(
rollCall: string,
actionItems: string,
meetingTopics: string
): string {
// read in template file
const issueTemplate = fs.readFileSync('./static/meeting-template.md', 'utf8')
return issueTemplate
.replace('{{roll-call-notification}}', rollCall)
.replace('{{action-items}}', actionItems)
.replace('{{meeting-topics}}', meetingTopics)
}
36 changes: 36 additions & 0 deletions src/rollCall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as core from '@actions/core'
import axios from 'axios'

export async function GetRollCall(): Promise<string> {
try {
console.log(`GetRollCall started`)

// Define the meeting message and opt-out reminder
const meetingMessage =
'FCOS community meeting in #meeting-1:fedoraproject.org'
const optOutReminder =
"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"

// Fetch the roll call from the specified URL
const fetchedRollCall = await fetchData(core.getInput('peopleListURL'))

// Extract the list of people to ping
const peopleList = fetchedRollCall.split('\n').slice(4).join(' ')
console.log(peopleList)

// Return the list of people along with the meeting message and opt-out reminder
return `${peopleList}\n${meetingMessage}\n${optOutReminder}`
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
return `Failed to get Roll-call. Check the last meeting notes.`
}
}

async function fetchData(url: string): Promise<string> {
const options = {
method: `GET`,
url
}
return (await axios(options)).data
}
6 changes: 2 additions & 4 deletions static/meeting-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ 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
```
{{roll-call-notification}}
```
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 d73cb3a

Please sign in to comment.