diff --git a/action.yml b/action.yml index 78940ac..57ad390 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/dist/index.js b/dist/index.js index 459995a..7e2e8f6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -22870,6 +22870,69 @@ async function fetchData(url) { } +/***/ }), + +/***/ 6975: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.GetAttendees = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const axios_1 = __importDefault(__nccwpck_require__(8757)); +async function GetAttendees() { + 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(1).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`; + } +} +exports.GetAttendees = GetAttendees; +async function fetchData(url) { + const options = { + method: `GET`, + url + }; + return (await (0, axios_1.default)(options)).data; +} + + /***/ }), /***/ 463: @@ -22972,6 +23035,7 @@ const core = __importStar(__nccwpck_require__(2186)); const actionItems_1 = __nccwpck_require__(6139); const meetingTopics_1 = __nccwpck_require__(9220); const createIssue_1 = __nccwpck_require__(463); +const attendees_1 = __nccwpck_require__(6975); const fs_1 = __importDefault(__nccwpck_require__(7147)); /** * The main function for the action. @@ -22979,13 +23043,15 @@ const fs_1 = __importDefault(__nccwpck_require__(7147)); */ async function run() { try { + console.log('GetAttendees'); + const attendees = await (0, attendees_1.GetAttendees)(); console.log('GetActionItems'); const actionItems = await (0, actionItems_1.GetActionItems)(); console.log(actionItems); console.log('Get meeting topics'); const meetingTopics = await (0, meetingTopics_1.GetMeetingTopics)(); console.log(meetingTopics); - const issueBody = hydrateIssueTemplate(actionItems, meetingTopics); + const issueBody = hydrateIssueTemplate(attendees, actionItems, meetingTopics); console.log('Create issue'); (0, createIssue_1.createThisReposIssue)(issueBody); } @@ -22997,10 +23063,11 @@ async function run() { } exports.run = run; // read in templated issue body, and replace the placeholders with the actual content -function hydrateIssueTemplate(actionItems, meetingTopics) { +function hydrateIssueTemplate(attendees, actionItems, meetingTopics) { // read in template file const issueTemplate = fs_1.default.readFileSync('./static/meeting-template.md', 'utf8'); return issueTemplate + .replace('{{attendees}}', attendees) .replace('{{action-items}}', actionItems) .replace('{{meeting-topics}}', meetingTopics); } diff --git a/src/attendees.ts b/src/attendees.ts new file mode 100644 index 0000000..0a010c0 --- /dev/null +++ b/src/attendees.ts @@ -0,0 +1,26 @@ +import * as core from '@actions/core' +import axios from 'axios' + +export async function GetAttendees(): Promise { + 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(1).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 { + const options = { + method: `GET`, + url + } + return (await axios(options)).data +} diff --git a/src/main.ts b/src/main.ts index 9ddeef7..b6b7c57 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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' /** @@ -10,6 +11,9 @@ import fs from 'fs' */ export async function run(): Promise { try { + console.log('GetAttendees') + const attendees = await GetAttendees() + console.log('GetActionItems') const actionItems = await GetActionItems() console.log(actionItems) @@ -18,7 +22,11 @@ export async function run(): Promise { 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) { @@ -29,12 +37,14 @@ export async function run(): Promise { // 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) } diff --git a/static/meeting-template.md b/static/meeting-template.md index 668af7a..7a5b08d 100644 --- a/static/meeting-template.md +++ b/static/meeting-template.md @@ -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