Skip to content

Commit

Permalink
feat: simplify meetings scheduling (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Mar 23, 2022
1 parent c27f881 commit 6ecdff8
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 123 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/create-event-issue-community-meeting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Schedule Community Meeting

on:
workflow_dispatch:
inputs:
time:
description: 'Info about meeting hour in UTC time zone, like: 08 or 16. No PM or AM versions.'
required: true
date:
description: 'Date in a form like: 2022-04-05 where 04 is a month and 05 is a day number.'
required: true

jobs:

setup-community-meeting:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
name: Setup Community meeting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create issue content
uses: actions/github-script@v4
id: date
with:
script: |
const { getMeetingIssueContent } = require('./.github/workflows/event_issue_templates/meetings/community.js');
const setupMeeting = require('./.github/workflows/event_issue_templates/index.js');
setupMeeting('${{ github.event.inputs.date }}', '${{ github.event.inputs.time }}', core, getMeetingIssueContent);
- name: Create issue with meeting details
run: gh issue create -l meeting -t "Community Meeting, ${{steps.date.outputs.hour}}:00 UTC ${{steps.date.outputs.fullDate}}" -F content.md
36 changes: 36 additions & 0 deletions .github/workflows/create-event-issue-lets-talk-about.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Schedule Lets talk about contributing Meeting

on:
workflow_dispatch:
inputs:
time:
description: 'Info about meeting hour in UTC time zone, like: 08 or 16. No PM or AM versions.'
required: true
date:
description: 'Date in a form like: 2022-04-05 where 04 is a month and 05 is a day number.'
required: true
descSuffix:
description: 'You can specify additional text that appears at the end of generated issue title, like: - Product Design'
required: false
default: ''

jobs:

setup-lets-talk-about-contrib-stream:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
name: Setup Lets talk about contributing live stream
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create issue content
uses: actions/github-script@v4
id: date
with:
script: |
const { getMeetingIssueContent } = require('./.github/workflows/event_issue_templates/meetings/lets-talk-about-contrib.js');
const setupMeeting = require('./.github/workflows/event_issue_templates/index.js');
setupMeeting('${{ github.event.inputs.date }}', '${{ github.event.inputs.time }}', core, getMeetingIssueContent);
- name: Create issue with meeting details
run: gh issue create -l meeting -t "Let's talk about contributing, ${{steps.date.outputs.hour}}:00 UTC ${{steps.date.outputs.fullDate}} ${{ github.event.inputs.descSuffix }}" -F content.md
32 changes: 32 additions & 0 deletions .github/workflows/create-event-issue-spec-3-0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Schedule Spec 3.0 Meeting

on:
workflow_dispatch:
inputs:
time:
description: 'Info about meeting hour in UTC time zone, like: 08 or 16. No PM or AM versions.'
required: true
date:
description: 'Date in a form like: 2022-04-05 where 04 is a month and 05 is a day number.'
required: true

jobs:

setup-spec-3-0-meeting:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
name: Setup 3.0 spec meeting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create issue content
uses: actions/github-script@v4
id: date
with:
script: |
const { getMeetingIssueContent } = require('./.github/workflows/event_issue_templates/meetings/spec-3-0.js');
const setupMeeting = require('./.github/workflows/event_issue_templates/index.js');
setupMeeting('${{ github.event.inputs.date }}', '${{ github.event.inputs.time }}', core, getMeetingIssueContent);
- name: Create issue with meeting details
run: gh issue create -l meeting -t "Spec 3.0 Meeting, ${{steps.date.outputs.hour}}:00 UTC ${{steps.date.outputs.fullDate}}" -F content.md
89 changes: 0 additions & 89 deletions .github/workflows/create-event-issue.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/event_issue_templates/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const { writeFileSync } = require('fs');
const { getMeetingIssueContent } = require('./meetings/community.js');
const { parseDate } = require('./utils/date.js');

/**
* @param {string} date Date as YYYY-MM-DD
* @param {string} time Number that represents hour, 2-digit format
* @param {string} code Entire core package helper
* @param {string} getMeetingIssueContent Function that returns content of the meeting issue
*/
module.exports = (date, time, core, getMeetingIssueContent) => {

core.info(`Workflow triggered with the following hour ${time} and date ${date}`);
const dateDetails = parseDate(`${ date }T${ time }:00:00Z`);

core.info('This is how time and date looks like after parsing:');
core.info(JSON.stringify(dateDetails));

if (dateDetails === 'Invalid Date') core.setFailed('Invalid date of the event. Make sure that you provided correct hour of the meeting and date in a format described in the meeting input form.')

const issueContent = getMeetingIssueContent(dateDetails.hour, dateDetails.formattedDate);

writeFileSync('content.md', issueContent, { encoding: 'utf8'});

core.setOutput('formattedDate', dateDetails.formattedDate);
core.setOutput('fullDate', dateDetails.fullDate);
core.setOutput('hour', dateDetails.hour);
}
28 changes: 28 additions & 0 deletions .github/workflows/event_issue_templates/meetings/community.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports.getMeetingIssueContent = (time, date) => {

return `This is the AsyncAPI Community meeting. You're invited to [join us live on Zoom](https://zoom.us/j/165106914) and ask questions. **The meeting takes place on alternate Tuesdays**. Recordings from the previous meetings are available in [this](https://www.youtube.com/playlist?list=PLbi1gRlP7pijUwZJErzyYf_Rc-PWu4lXS) playlist on YouTube.
**This time we meet at ${time}:00 UTC. Check what time is it in your time zone with [time zone converter](https://dateful.com/convert/coordinated-universal-time-utc?t=${time}&d=${date})**
Join [this](https://groups.google.com/forum/#!forum/asyncapi-users) mailing list to get an always-up-to-date invite to the meeting in your calendar. You can also check [AsyncAPI Calendar](https://calendar.google.com/calendar/u/0/embed?src=tbrbfq4de5bcngt8okvev4lstk@group.calendar.google.com).
## Agenda
> Don't wait for the meeting to discuss topics that already have issues. Feel free to comment on them earlier.
1. Q&A
1. _Place for your topic_
1. Q&A
## Notes
tbd
## Chat
tbd
## Recording
tbd`
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports.getMeetingIssueContent = (time, everytimezone) => {
module.exports.getMeetingIssueContent = (time, date) => {

return `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. AsyncAPI Initiative is a large project, with lots of code, lots of docs, and many many other areas that need help, but it is not easy to start.
Recordings from the previous meetings are available in [this](https://www.youtube.com/playlist?list=PLbi1gRlP7pigPBrBMaNQhUeniR1pdDMiY) playlist on YouTube.
**This time we meet at [${time} UTC](${everytimezone})**
**This time we meet at ${time}:00 UTC. Check what time is it in your time zone with [time zone converter](https://dateful.com/convert/coordinated-universal-time-utc?t=${time}&d=${date})**
Join [this](https://groups.google.com/forum/#!forum/asyncapi-users) mailing list to get an always-up-to-date invite to the meeting in your calendar. You can also check [AsyncAPI Calendar](https://calendar.google.com/calendar/u/0/embed?src=tbrbfq4de5bcngt8okvev4lstk@group.calendar.google.com).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports.getMeetingIssueContent = (time, everytimezone) => {
module.exports.getMeetingIssueContent = (time, date) => {

return `This is the meeting for community member involved in works related to 3.0 release of AsyncAPI Specification.
**The meeting takes place bi-weekly on Wednesdays**. First and third week every month until release. Recordings from the previous meetings are available in [this](https://www.youtube.com/playlist?list=PLbi1gRlP7pihClJY-kXuTRRJ8n1awb0VV) playlist on YouTube.
**This time we meet at [${time} UTC](${everytimezone})**
**This time we meet at ${time}:00 UTC. Check what time is it in your time zone with [time zone converter](https://dateful.com/convert/coordinated-universal-time-utc?t=${time}&d=${date})**
Join [this mailing list](https://groups.google.com/forum/#!forum/asyncapi-users) to get an always-up-to-date invite to the meeting in your calendar. You can also check [AsyncAPI Calendar](https://calendar.google.com/calendar/u/0/embed?src=tbrbfq4de5bcngt8okvev4lstk@group.calendar.google.com).
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/event_issue_templates/sig.js

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/event_issue_templates/utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Instead of using `package.json` and building complex build system for scripts that setup AsyncAPI meetings, we keep source code of minified [day.js](https://github.com/iamkun/dayjs) and its UTC-format plugin here in `utils` folder directly. This scripts run on CI, and are not vulerable so do not need `package.json` and regular security updates.
19 changes: 19 additions & 0 deletions .github/workflows/event_issue_templates/utils/date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const dayjs = require('./dayjs.min.js');
const utc = require('./utc.js');
dayjs.extend(utc);

/**
* @param {string} date Date as 2019-01-25T08:00:00Z
*/
module.exports.parseDate = (date) => {

const meetingDate = dayjs(date);
const formattedDate = meetingDate.utc().format('YYYY-MM-DD');
const fullDate = meetingDate.utc().format('dddd MMMM D YYYY');
const hour = meetingDate.utc().format('H');

return { formattedDate, fullDate, hour }
}



Loading

0 comments on commit 6ecdff8

Please sign in to comment.