Skip to content

Commit

Permalink
added yt playlist as input and fixed issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoshreyansh committed Nov 6, 2023
1 parent 528366a commit a95b586
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/create-event-ad-hoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
meeting_banner:
description: 'Meeting banner(image) URL'
required: false
yt_playlist:
description: 'Youtube Playlist ID for the stream'
required: false

jobs:

Expand All @@ -29,6 +32,7 @@ jobs:
meeting_name: ${{ github.event.inputs.name }}
meeting_desc: ${{ github.event.inputs.desc }}
meeting_banner: ${{ github.event.inputs.meeting_banner }}
yt_playlist: ${{ github.events.inputs.yt_playlist }}
host: lpgornicki@gmail.com
alternative_host: "fmvilas@gmail.com,jonas-lt@live.dk,devlopergene@gmail.com,sibanda.thulie@gmail.com"
issue_template_path: .github/workflows/create-event-helpers/issues_templates/ad-hoc.md
Expand All @@ -45,3 +49,5 @@ jobs:
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
GOOGLE_OAUTH_TOKEN: ${{ secrets.GOOGLE_OAUTH_TOKEN }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
3 changes: 3 additions & 0 deletions .github/workflows/create-event-community-meeting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
meeting_banner: ${{ github.event.inputs.meeting_banner }}
meeting_name: Community Meeting
meeting_desc: This is a community meeting to regularly talk in open about important topics around AsyncAPI Initiative.
yt_playlist: PLbi1gRlP7pijUwZJErzyYf_Rc-PWu4lXS
host: lpgornicki@gmail.com
alternative_host: 'fmvilas@gmail.com,devlopergene@gmail.com,sibanda.thulie@gmail.com'
issue_template_path: .github/workflows/create-event-helpers/issues_templates/community.md
Expand All @@ -38,3 +39,5 @@ jobs:
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
GOOGLE_OAUTH_TOKEN: ${{ secrets.GOOGLE_OAUTH_TOKEN }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
9 changes: 4 additions & 5 deletions .github/workflows/create-event-helpers/youtube/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,16 @@ module.exports = { scheduleLivestream };
/**
* Schedules a live stream with the parameters provided.
*
* @param {String} title Title
* @param {String} description Description
* @param {String} scheduledStartTime RFC3339 scheduled starting time
* @param {String} thumbnail Thumbnail URL (only supports PNG and JPG formats)
* @param {String} playlistId Playlist ID to add the stream to
*/
async function scheduleLivestream(scheduledStartTime, playlistId) {
async function scheduleLivestream(scheduledStartTime) {
try {
const title = process.env.MEETING_NAME;
const suffix = process.env.MEETING_NAME_SUFFIX;
const description = process.env.MEETING_DESC;
const banner = process.env.MEETING_BANNER;
const summary = suffix ? `${title} ${suffix}` : title;
const playlistId = process.env.YT_PLAYLIST;

const id = await _createNewBroadcast(summary, description, scheduledStartTime);
await Promise.all([
Expand Down Expand Up @@ -98,6 +95,8 @@ function _addThumbnailToVideo(videoId, thumbnailUri) {

function _addVideoToPlaylist(videoId, playlistId) {
return new Promise((resolve, reject) => {
if ( !playlistId ) return resolve();

youtube.playlistItems.insert({
auth: OAUTH_CLIENT,
part: 'contentDetails,id,snippet,status',
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/create-event-lets-talk-about.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
meeting_name_suffix: ${{ github.event.inputs.descSuffix }}
meeting_banner: ${{ github.event.inputs.meeting_banner }}
meeting_desc: The purpose of this meeting is to focus on contributors, focus on people that want to contribute to AsyncAPI Initiative but do not know how to do it.
yt_playlist: PLbi1gRlP7pigPBrBMaNQhUeniR1pdDMiY
host: lpgornicki@gmail.com
alternative_host: 'fmvilas@gmail.com,devlopergene@gmail.com,sibanda.thulie@gmail.com'
issue_template_path: .github/workflows/create-event-helpers/issues_templates/lets-talk-about-contrib.md
Expand All @@ -42,3 +43,5 @@ jobs:
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
GOOGLE_OAUTH_TOKEN: ${{ secrets.GOOGLE_OAUTH_TOKEN }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
3 changes: 3 additions & 0 deletions .github/workflows/create-event-spec-3-0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
meeting_banner: ${{ github.event.inputs.meeting_banner }}
meeting_name: Spec 3.0 Meeting
meeting_desc: This is the meeting for community member involved in works related to 3.0 release of AsyncAPI Specification.
yt_playlist: PLbi1gRlP7pihClJY-kXuTRRJ8n1awb0VV
host: jonas-lt@live.dk
alternative_host: fmvilas@gmail.com
issue_template_path: .github/workflows/create-event-helpers/issues_templates/spec-3-0.md
Expand All @@ -39,3 +40,5 @@ jobs:
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
GOOGLE_OAUTH_TOKEN: ${{ secrets.GOOGLE_OAUTH_TOKEN }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
2 changes: 2 additions & 0 deletions .github/workflows/create-event-spec-3-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ jobs:
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
GOOGLE_OAUTH_TOKEN: ${{ secrets.GOOGLE_OAUTH_TOKEN }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
6 changes: 6 additions & 0 deletions .github/workflows/create-event-thinking-out-loud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
meeting_banner:
description: 'Meeting banner(image) URL'
required: false
yt_playlist:
description: 'Youtube Playlist ID for the stream'
required: false

jobs:
setup-thinking-out-loud:
Expand All @@ -29,6 +32,7 @@ jobs:
meeting_name: Thinking Out Loud
meeting_desc: ${{ github.event.inputs.desc }}
guest: ${{ github.event.inputs.guest }}
yt_playlist: PLbi1gRlP7pigPxRRylHGCvpdppYLmSKfJ
host: fmvilas@gmail.com
issue_template_path: .github/workflows/create-event-helpers/issues_templates/thinking-out-loud.md
create_zoom: true
Expand All @@ -44,3 +48,5 @@ jobs:
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
GOOGLE_OAUTH_TOKEN: ${{ secrets.GOOGLE_OAUTH_TOKEN }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
7 changes: 6 additions & 1 deletion .github/workflows/create-event-workflow-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ on:
description: 'Meeting banner(image) URL'
required: false
type: string
yt_playlist:
description: 'Youtube Playlist ID for the stream'
required: false
type: string
secrets:
GH_TOKEN:
required: true
Expand Down Expand Up @@ -167,7 +171,8 @@ jobs:
MEETING_DESC: ${{ inputs.meeting_desc }}
MEETING_BANNER: ${{ inputs.meeting_banner }}
GUEST: ${{ inputs.guest }}
YT_PLAYLIST: ${{ inputs.yt_playlist }}
with:
script: |
const { scheduleLivestream } = require('./.github/workflows/create-event-helpers/youtube/index.js');
scheduleLivestream('${{ inputs.date }}T${{ inputs.time }}:00Z', 'PLbi1gRlP7pijUwZJErzyYf_Rc-PWu4lXS');
scheduleLivestream('${{ inputs.date }}T${{ inputs.time }}:00Z');

0 comments on commit a95b586

Please sign in to comment.