Skip to content

Commit

Permalink
ci: fix meetings scheduling broken by zoom auth changes
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg committed Sep 25, 2023
1 parent e18e7ef commit 536722f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 168 deletions.
160 changes: 0 additions & 160 deletions .github/workflows/create-event-helpers/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .github/workflows/create-event-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"@actions/core": "^1.6.0",
"@mailchimp/mailchimp_marketing": "^3.0.74",
"googleapis": "^99.0.0",
"jsonwebtoken": "^8.5.1",
"node-fetch": "2.6.1"
}
}
24 changes: 17 additions & 7 deletions .github/workflows/create-event-helpers/zoom/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fetch = require('node-fetch');
const jwt = require('jsonwebtoken');
const { URLSearchParams } = require('url');
const core = require('@actions/core');

/**
Expand All @@ -11,15 +11,25 @@ const core = require('@actions/core');
module.exports = async(date, time, host, cohost) => {

const meetingTitle = process.env.MEETING_NAME;
let meetingDetails;
let meetingDetails, token;

const tokenConfig = {
iss: process.env.ZOOM_API_KEY,
exp: ((new Date()).getTime() + 5000)
//getting request token
try {
const params = new URLSearchParams();
params.append('grant_type', 'account_credentials');
params.append('account_id', process.env.ZOOM_ACCOUNT_ID);
const tokenCreationResponse = await fetch('https://zoom.us/oauth/token', {
method: 'POST',
body: params,
headers: {
Authorization: `Basic ${ process.env.ZOOM_TOKEN }`
},
});
token = (await tokenCreationResponse.json()).access_token;
} catch (error) {
return core.setFailed(`Failed getting token: ${ error }`)
}

const token = jwt.sign(tokenConfig, process.env.ZOOM_API_SECRET);

const zoomSettings = JSON.stringify({
topic: meetingTitle,
type: '2',
Expand Down

0 comments on commit 536722f

Please sign in to comment.