Added video to adaptive card json
This commit is contained in:
parent
38f82b2fd2
commit
ebafd947e2
|
@ -0,0 +1,15 @@
|
||||||
|
const core = require('@actions/core');
|
||||||
|
const github = require('@actions/github');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// `who-to-greet` input defined in action metadata file
|
||||||
|
const nameToGreet = core.getInput('who-to-greet');
|
||||||
|
console.log(`Hello ${nameToGreet}!`);
|
||||||
|
const time = (new Date()).toTimeString();
|
||||||
|
core.setOutput("time", time);
|
||||||
|
// Get the JSON webhook payload for the event that triggered the workflow
|
||||||
|
const payload = JSON.stringify(github.context.payload, undefined, 2)
|
||||||
|
console.log(`The event payload: ${payload}`);
|
||||||
|
} catch (error) {
|
||||||
|
core.setFailed(error.message);
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
export interface GitHubIssue {
|
||||||
|
active_lock_reason?: any;
|
||||||
|
assignee?: any;
|
||||||
|
assignees: any[];
|
||||||
|
author_association: string;
|
||||||
|
body: string;
|
||||||
|
closed_at?: any;
|
||||||
|
comments: number;
|
||||||
|
comments_url: string;
|
||||||
|
created_at: string;
|
||||||
|
events_url: string;
|
||||||
|
html_url: string;
|
||||||
|
id: number;
|
||||||
|
labels: any[];
|
||||||
|
labels_url: string;
|
||||||
|
locked: boolean;
|
||||||
|
milestone?: any;
|
||||||
|
node_id: string;
|
||||||
|
number: number;
|
||||||
|
performed_via_github_app?: any;
|
||||||
|
repository_url: string;
|
||||||
|
state: string;
|
||||||
|
timeline_url: string;
|
||||||
|
title: string;
|
||||||
|
updated_at: string;
|
||||||
|
url: string;
|
||||||
|
user: User;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface User {
|
||||||
|
avatar_url: string;
|
||||||
|
events_url: string;
|
||||||
|
followers_url: string;
|
||||||
|
following_url: string;
|
||||||
|
gists_url: string;
|
||||||
|
gravatar_id: string;
|
||||||
|
html_url: string;
|
||||||
|
id: number;
|
||||||
|
login: string;
|
||||||
|
node_id: string;
|
||||||
|
organizations_url: string;
|
||||||
|
received_events_url: string;
|
||||||
|
repos_url: string;
|
||||||
|
site_admin: boolean;
|
||||||
|
starred_url: string;
|
||||||
|
subscriptions_url: string;
|
||||||
|
type: string;
|
||||||
|
url: string;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
import * as core from '@actions/core'
|
||||||
|
import { GitHubIssue } from './GitHubIssue'
|
||||||
|
|
||||||
|
async function run(): Promise<void> {
|
||||||
|
try {
|
||||||
|
const issue: string = core.getInput('issue')
|
||||||
|
core.debug(`Got issue: ${issue} ...`) // debug is only output if you set the secret `ACTIONS_STEP_DEBUG` to true
|
||||||
|
|
||||||
|
const gitHubIssue: GitHubIssue = JSON.parse(issue);
|
||||||
|
core.debug(`Got issue body: ${gitHubIssue.body} ...`) // debug is only output if you set the secret `ACTIONS_STEP_DEBUG` to true
|
||||||
|
|
||||||
|
const bodySections: Array<string> = gitHubIssue.body.split("### ");
|
||||||
|
core.debug(`Got issue body lines: ${JSON.stringify(bodySections)} ...`) // debug is only output if you set the secret `ACTIONS_STEP_DEBUG` to true
|
||||||
|
|
||||||
|
const bodyArray: { [key: string]: string } = {};
|
||||||
|
bodySections.forEach(section => {
|
||||||
|
// Split the section into header and content
|
||||||
|
const sectionParts: Array<string> = section.split("\n\n", 2);
|
||||||
|
if (sectionParts.length === 2 && sectionParts[0] !== "") {
|
||||||
|
bodyArray[sectionParts[0]] = sectionParts[1];
|
||||||
|
core.debug(`Section Part: '${sectionParts[0]}': '${sectionParts[1]}'`) // debug is only output if you set the secret `ACTIONS_STEP_DEBUG` to true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
core.setOutput('authors', bodyArray['Author(s)']);
|
||||||
|
if (bodyArray['Author(s)'].indexOf('@') > -1) {
|
||||||
|
core.setOutput('valid-authors',bodyArray['Author(s)']);
|
||||||
|
} else {
|
||||||
|
core.setOutput('valid-authors',"");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof Error) core.setFailed(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run()
|
|
@ -134,6 +134,12 @@
|
||||||
"order": 116,
|
"order": 116,
|
||||||
"url": "https://github.com/pnp/sp-dev-fx-webparts/blob/main/samples/react-adaptivecards/assets/YouNeedData.png?raw=true",
|
"url": "https://github.com/pnp/sp-dev-fx-webparts/blob/main/samples/react-adaptivecards/assets/YouNeedData.png?raw=true",
|
||||||
"alt": "Adaptive Cards Host"
|
"alt": "Adaptive Cards Host"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "video",
|
||||||
|
"order": 117,
|
||||||
|
"url": "https://www.youtube.com/watch?v=gWrvC-0HF4A",
|
||||||
|
"alt": "Demo of the web part in action"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
Loading…
Reference in New Issue