diff --git a/.github/workflows/validate-data.yaml b/.github/workflows/validate-data.yaml
new file mode 100644
index 0000000..3abd612
--- /dev/null
+++ b/.github/workflows/validate-data.yaml
@@ -0,0 +1,19 @@
+on:
+ push:
+ pull_request:
+
+jobs:
+ sync:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: actions/setup-node@v1
+ with:
+ node-version: "12"
+
+ - name: Validate workflows
+ run: |
+ npm ci
+ npx ts-node-script ./index.ts
+ working-directory: ./script/validate-data
diff --git a/icons/aws.svg b/icons/aws.svg
new file mode 100644
index 0000000..59ff870
--- /dev/null
+++ b/icons/aws.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icons/azure.svg b/icons/azure.svg
new file mode 100644
index 0000000..2ff63c1
--- /dev/null
+++ b/icons/azure.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icons/googlegke.svg b/icons/googlegke.svg
new file mode 100644
index 0000000..68ecb39
--- /dev/null
+++ b/icons/googlegke.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/script/validate-data/index.ts b/script/validate-data/index.ts
new file mode 100755
index 0000000..dbea113
--- /dev/null
+++ b/script/validate-data/index.ts
@@ -0,0 +1,118 @@
+#!/usr/bin/env npx ts-node
+import { promises as fs } from "fs";
+import { safeLoad } from "js-yaml";
+import { basename, extname, join } from "path";
+import { Validator as validator } from "jsonschema";
+import { endGroup, error, info, setFailed, startGroup } from '@actions/core';
+
+interface WorkflowWithErrors {
+ id: string;
+ errors: string[];
+}
+
+interface WorkflowProperties {
+ name: string;
+ description: string;
+ iconName: string;
+ categories: string[];
+}
+
+const propertiesSchema = {
+ type: "object",
+ properties: {
+ name: { type: "string", required: true },
+ description: { type: "string", required: true },
+ iconName: { type: "string", required: true },
+ categories: {
+ anyOf: [
+ {
+ type: "array",
+ items: { type: "string" }
+ },
+ {
+ type: "null",
+ }
+ ],
+ required: true
+ },
+ }
+}
+
+async function checkWorkflows(folders: string[]): Promise {
+ const result: WorkflowWithErrors[] = []
+
+ for (const folder of folders) {
+ const dir = await fs.readdir(folder, {
+ withFileTypes: true,
+ });
+
+ for (const e of dir) {
+ if (e.isFile()) {
+ const fileType = basename(e.name, extname(e.name))
+
+ const workflowFilePath = join(folder, e.name);
+ const propertiesFilePath = join(folder, "properties", `${fileType}.properties.json`)
+
+ const errors = await checkWorkflow(workflowFilePath, propertiesFilePath);
+ if (errors.errors.length > 0) {
+ result.push(errors)
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+async function checkWorkflow(workflowPath: string, propertiesPath: string): Promise {
+ let workflowErrors: WorkflowWithErrors = {
+ id: workflowPath,
+ errors: []
+ }
+
+ try {
+ const workflowFileContent = await fs.readFile(workflowPath, "utf8");
+ safeLoad(workflowFileContent); // Validate yaml parses without error
+
+ const propertiesFileContent = await fs.readFile(propertiesPath, "utf8")
+ const properties: WorkflowProperties = JSON.parse(propertiesFileContent)
+
+ let v = new validator();
+ const res = v.validate(properties, propertiesSchema)
+ workflowErrors.errors = res.errors.map(e => e.toString())
+
+ if (properties.iconName && !properties.iconName.startsWith("octicon")) {
+ try {
+ await fs.access(`../../icons/${properties.iconName}.svg`)
+ } catch (e) {
+ workflowErrors.errors.push(`No icon named ${properties.iconName} found`)
+ }
+ }
+ } catch (e) {
+ workflowErrors.errors.push(e.toString())
+ }
+ return workflowErrors;
+}
+
+(async function main() {
+ try {
+ const settings = require("./settings.json");
+ const erroredWorkflows = await checkWorkflows(
+ settings.folders
+ )
+
+ if (erroredWorkflows.length > 0) {
+ startGroup(`😟 - Found ${erroredWorkflows.length} workflows with errors:`);
+ erroredWorkflows.forEach(erroredWorkflow => {
+ error(`Errors in ${erroredWorkflow.id} - ${erroredWorkflow.errors.map(e => e.toString()).join(", ")}`)
+ })
+ endGroup();
+ setFailed(`Found ${erroredWorkflows.length} workflows with errors`);
+ } else {
+ info("🎉🤘 - Found no workflows with errors!")
+ }
+ } catch (e) {
+ error(`Unhandled error while syncing workflows: ${e}`);
+ setFailed(`Unhandled error`)
+ }
+})();
diff --git a/script/validate-data/package-lock.json b/script/validate-data/package-lock.json
new file mode 100644
index 0000000..110d23f
--- /dev/null
+++ b/script/validate-data/package-lock.json
@@ -0,0 +1,122 @@
+{
+ "name": "sync-ghes-actions",
+ "version": "1.0.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@actions/core": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
+ "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
+ },
+ "@types/js-yaml": {
+ "version": "3.12.4",
+ "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-3.12.4.tgz",
+ "integrity": "sha512-fYMgzN+9e28R81weVN49inn/u798ruU91En1ZnGvSZzCRc5jXx9B2EDhlRaWmcO1RIxFHL8AajRXzxDuJu93+A==",
+ "dev": true
+ },
+ "@types/node": {
+ "version": "14.0.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.1.tgz",
+ "integrity": "sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==",
+ "dev": true
+ },
+ "arg": {
+ "version": "4.1.3",
+ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
+ "dev": true
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "buffer-from": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
+ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
+ "dev": true
+ },
+ "diff": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
+ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
+ "dev": true
+ },
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
+ },
+ "js-yaml": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
+ "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "jsonschema": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.6.tgz",
+ "integrity": "sha512-SqhURKZG07JyKKeo/ir24QnS4/BV7a6gQy93bUSe4lUdNp0QNpIz2c9elWJQ9dpc5cQYY6cvCzgRwy0MQCLyqA=="
+ },
+ "make-error": {
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
+ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
+ "dev": true
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "source-map-support": {
+ "version": "0.5.19",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
+ "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
+ "dev": true,
+ "requires": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
+ }
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
+ },
+ "ts-node": {
+ "version": "8.10.1",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.1.tgz",
+ "integrity": "sha512-bdNz1L4ekHiJul6SHtZWs1ujEKERJnHs4HxN7rjTyyVOFf3HaJ6sLqe6aPG62XTzAB/63pKRh5jTSWL0D7bsvw==",
+ "dev": true,
+ "requires": {
+ "arg": "^4.1.0",
+ "diff": "^4.0.1",
+ "make-error": "^1.1.1",
+ "source-map-support": "^0.5.17",
+ "yn": "3.1.1"
+ }
+ },
+ "typescript": {
+ "version": "3.9.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz",
+ "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==",
+ "dev": true
+ },
+ "yn": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
+ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
+ "dev": true
+ }
+ }
+}
diff --git a/script/validate-data/package.json b/script/validate-data/package.json
new file mode 100644
index 0000000..a2b867d
--- /dev/null
+++ b/script/validate-data/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "validate-data",
+ "version": "1.0.0",
+ "main": "index.ts",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "github/c2c-actions-experience",
+ "license": "MIT",
+ "devDependencies": {
+ "@types/js-yaml": "^3.12.4",
+ "@types/node": "^14.0.1",
+ "ts-node": "^8.10.1",
+ "typescript": "^3.9.2"
+ },
+ "dependencies": {
+ "@actions/core": "^1.2.4",
+ "js-yaml": "^3.13.1",
+ "jsonschema": "^1.2.6"
+ }
+}
\ No newline at end of file
diff --git a/script/validate-data/settings.json b/script/validate-data/settings.json
new file mode 100644
index 0000000..1913e2f
--- /dev/null
+++ b/script/validate-data/settings.json
@@ -0,0 +1,6 @@
+{
+ "folders": [
+ "../../ci",
+ "../../automation"
+ ]
+}
\ No newline at end of file
diff --git a/script/validate-data/tsconfig.json b/script/validate-data/tsconfig.json
new file mode 100644
index 0000000..7c50a20
--- /dev/null
+++ b/script/validate-data/tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "compilerOptions": {
+ },
+ "include": ["*.ts"]
+}
\ No newline at end of file