Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix meetings scheduling broken by zoom auth changes #882

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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