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..6d64681 100644 --- a/dist/index.js +++ b/dist/index.js @@ -22972,6 +22972,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 rollCall_1 = __nccwpck_require__(3890); const fs_1 = __importDefault(__nccwpck_require__(7147)); /** * The main function for the action. @@ -22979,13 +22980,15 @@ const fs_1 = __importDefault(__nccwpck_require__(7147)); */ async function run() { try { + console.log('GetActionItems'); + const rollCall = await (0, rollCall_1.GetRollCall)(); 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(rollCall, actionItems, meetingTopics); console.log('Create issue'); (0, createIssue_1.createThisReposIssue)(issueBody); } @@ -22997,10 +23000,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(rollCall, actionItems, meetingTopics) { // read in template file const issueTemplate = fs_1.default.readFileSync('./static/meeting-template.md', 'utf8'); return issueTemplate + .replace('{{roll-call-notification}}', rollCall) .replace('{{action-items}}', actionItems) .replace('{{meeting-topics}}', meetingTopics); } @@ -23072,6 +23076,74 @@ async function GetMeetingTopics() { exports.GetMeetingTopics = GetMeetingTopics; +/***/ }), + +/***/ 3890: +/***/ (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.GetRollCall = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const axios_1 = __importDefault(__nccwpck_require__(8757)); +async function GetRollCall() { + 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.`; + } +} +exports.GetRollCall = GetRollCall; +async function fetchData(url) { + const options = { + method: `GET`, + url + }; + return (await (0, axios_1.default)(options)).data; +} + + /***/ }), /***/ 9491: diff --git a/src/main.ts b/src/main.ts index 9ddeef7..0de4ac1 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 { GetRollCall } from './rollCall' import fs from 'fs' /** @@ -10,6 +11,9 @@ import fs from 'fs' */ export async function run(): Promise { try { + console.log('GetActionItems') + const rollCall = await GetRollCall() + console.log('GetActionItems') const actionItems = await GetActionItems() console.log(actionItems) @@ -18,7 +22,7 @@ export async function run(): Promise { 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) { @@ -29,12 +33,14 @@ export async function run(): Promise { // 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) } diff --git a/src/rollCall.ts b/src/rollCall.ts new file mode 100644 index 0000000..9fb269d --- /dev/null +++ b/src/rollCall.ts @@ -0,0 +1,36 @@ +import * as core from '@actions/core' +import axios from 'axios' + +export async function GetRollCall(): Promise { + 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 { + const options = { + method: `GET`, + url + } + return (await axios(options)).data +} diff --git a/static/meeting-template.md b/static/meeting-template.md index 668af7a..ba98305 100644 --- a/static/meeting-template.md +++ b/static/meeting-template.md @@ -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