generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meeting-template: Add rollCall function
Fixes #77
- Loading branch information
Showing
5 changed files
with
122 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters