diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 35bfb44..01bb7bc 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -1,7 +1,17 @@
-Thank you for sending in this pull request. Please make sure you take a look at the [contributing file](https://github.com/actions/starter-workflows/blob/master/CONTRIBUTING.md). Here's a few things for you to consider in this pull request:
+This repository contains configuration for what users see when they click on the `Actions` tab.
-- [ ] Include a good description of the workflow.
-- [ ] Links to the language or tool will be nice (unless its really obvious)
+It is not:
+* A playground to try out scripts
+* A place for you to create a workflow for your repository
+
+---
+
+Thank you for sending in this pull request. Please make sure you take a look at the [contributing file](https://github.com/actions/starter-workflows/blob/master/CONTRIBUTING.md). Here's a few things for you to consider in this pull request.
+
+Please **add to this description** at the bottom :point_down:
+
+- [ ] A good description of the workflow at the bottom of this page.
+- [ ] Some links to the language or tool will be nice (unless its really obvious)
In the workflow and properties files:
@@ -13,14 +23,12 @@ In the workflow and properties files:
- [ ] The name of CI workflows should only be the name of the language or platform: for example "Go" (not "Go CI" or "Go Build")
- [ ] Include comments in the workflow for any parts that are not obvious or could use clarification.
- [ ] CI workflows should run on `push` to `branches: [ master ]` and `pull_request` to `branches: [ master ]`.
-
- Packaging workflows should run on `release` with `types: [ created ]`.
+- [ ] Packaging workflows should run on `release` with `types: [ created ]`.
Some general notes:
- [ ] This workflow must only use actions that are produced by GitHub, [in the `actions` organization](https://github.com/actions), **or**
-
- This workflow must only use actions that are produced by the language or ecosystem that the workflow supports. These actions must be [published to the GitHub Marketplace](https://github.com/marketplace?type=actions). Workflows using these actions must reference the action using the full 40 character hash of the action's commit instead of a tag. Additionally, workflows must include the following comment at the top of the workflow file:
+- [ ] This workflow must only use actions that are produced by the language or ecosystem that the workflow supports. These actions must be [published to the GitHub Marketplace](https://github.com/marketplace?type=actions). Workflows using these actions must reference the action using the full 40 character hash of the action's commit instead of a tag. Additionally, workflows must include the following comment at the top of the workflow file:
```
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
diff --git a/.github/workflows/label-close.yml b/.github/workflows/label-close.yml
new file mode 100644
index 0000000..c6f2aa4
--- /dev/null
+++ b/.github/workflows/label-close.yml
@@ -0,0 +1,19 @@
+name: Close as a support issue
+on:
+ issues:
+ types: [labeled]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Close Issue
+ uses: peter-evans/close-issue@v1
+ if: contains(github.event.issue.labels.*.name, 'support')
+ with:
+ comment: |
+ Sorry, but we'd like to keep issues related to code in this repository. Thank you 🙇
+
+ If you have questions about writing workflows or action files, then please [visit the GitHub Community Forum's Actions Board](https://github.community/t5/GitHub-Actions/bd-p/actions)
+
+ If you are having an issue or question about GitHub Actions then please [contact customer support](https://help.github.com/en/articles/about-github-actions#contacting-support)
diff --git a/.github/workflows/sync_ghes.yaml b/.github/workflows/sync_ghes.yaml
new file mode 100644
index 0000000..54193bd
--- /dev/null
+++ b/.github/workflows/sync_ghes.yaml
@@ -0,0 +1,32 @@
+name: Sync workflows for GHES
+
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ sync:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - run: |
+ git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
+ git config user.email "cschleiden@github.com"
+ git config user.name "GitHub Actions"
+ - uses: actions/setup-node@v1
+ with:
+ node-version: '12'
+ - name: Check starter workflows for GHES compat
+ run: |
+ npm ci
+ npx ts-node-script ./index.ts
+ working-directory: ./script/sync-ghes
+ - run: |
+ git add -A
+ if [ -z "$(git status --porcelain)" ]; then
+ echo "No changes to commit"
+ else
+ git commit -m "Updating GHES workflows"
+ fi
+ - run: git push
diff --git a/.github/workflows/validate-data.yaml b/.github/workflows/validate-data.yaml
new file mode 100644
index 0000000..20eee71
--- /dev/null
+++ b/.github/workflows/validate-data.yaml
@@ -0,0 +1,21 @@
+name: Validate Data
+
+on:
+ push:
+ pull_request:
+
+jobs:
+ validate-data:
+ 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/.gitignore b/.gitignore
new file mode 100644
index 0000000..c5364f2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+script/**/node_modules
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..a5cc146
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,21 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "node",
+ "request": "launch",
+ "name": "Launch Program",
+ "args": ["${workspaceRoot}/script/index.ts"],
+ "runtimeArgs": ["-r", "ts-node/register"],
+ "cwd": "${workspaceRoot}/script",
+ "protocol": "inspector",
+ "internalConsoleOptions": "openOnSessionStart",
+ "env": {
+ "TS_NODE_IGNORE": "false"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 5d81359..fdd9bf8 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ These are the workflow files for helping people get started with GitHub Actions.
Each workflow must be written in YAML and have a `.yml` extension. They also need a corresponding `.properties.json` file that contains extra metadata about the workflow (this is displayed in the GitHub.com UI).
-For example: `ci/python-django.yml` and `ci/python-django.properties.json`.
+For example: `ci/python-django.yml` and `ci/properties/python-django.properties.json`.
**Valid properties:**
* `name`: the name shown in onboarding
diff --git a/ci/wpf-dotnet-core.yml b/ci/dotnet-core-desktop.yml
similarity index 94%
rename from ci/wpf-dotnet-core.yml
rename to ci/dotnet-core-desktop.yml
index 80ec3e5..ed37b70 100644
--- a/ci/wpf-dotnet-core.yml
+++ b/ci/dotnet-core-desktop.yml
@@ -3,9 +3,9 @@
# separate terms of service, privacy policy, and support
# documentation.
-# This workflow will build, test and package a WPF desktop application
+# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
# built on .NET Core.
-# To learn how to migrate your existing WPF application to .NET Core,
+# To learn how to migrate your existing application to .NET Core,
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
#
# To configure this workflow:
@@ -36,7 +36,7 @@
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
-name: WPF .NET Core
+name: .NET Core Desktop
on:
push:
@@ -81,8 +81,8 @@ jobs:
- name: Execute unit tests
run: dotnet test
- # Restore the WPF application to populate the obj folder with RuntimeIdentifiers
- - name: Restore the WPF application
+ # Restore the application to populate the obj folder with RuntimeIdentifiers
+ - name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
diff --git a/ci/elixir.yml b/ci/elixir.yml
index 4de7dcb..ac918c8 100644
--- a/ci/elixir.yml
+++ b/ci/elixir.yml
@@ -16,8 +16,8 @@ jobs:
- name: Setup elixir
uses: actions/setup-elixir@v1
with:
- elixir-version: 1.9.4 # Define the elixir version [required]
- otp-version: 22.2 # Define the OTP version [required]
+ elixir-version: '1.9.4' # Define the elixir version [required]
+ otp-version: '22.2' # Define the OTP version [required]
- name: Install Dependencies
run: mix deps.get
- name: Run Tests
diff --git a/ci/ibm.yml b/ci/ibm.yml
new file mode 100644
index 0000000..8af050f
--- /dev/null
+++ b/ci/ibm.yml
@@ -0,0 +1,74 @@
+# This workflow will build a docker container, publish it to IBM Container Registry, and deploy it to IKS when a release is created
+#
+# To configure this workflow:
+#
+# 1. Ensure that your repository contains a Dockerfile
+# 2. Setup secrets in your repository by going to settings: Create ICR_NAMESPACE and IBM_CLOUD_API_KEY
+# 3. Change the values for the IBM_CLOUD_REGION, REGISTRY_HOSTNAME, IMAGE_NAME, IKS_CLUSTER, DEPLOYMENT_NAME, and PORT
+
+name: Build and Deploy to IKS
+
+on:
+ release:
+ types: [created]
+
+# Environment variables available to all jobs and steps in this workflow
+env:
+ GITHUB_SHA: ${{ github.sha }}
+ IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }}
+ IBM_CLOUD_REGION: us-south
+ ICR_NAMESPACE: ${{ secrets.ICR_NAMESPACE }}
+ REGISTRY_HOSTNAME: us.icr.io
+ IMAGE_NAME: iks-test
+ IKS_CLUSTER: example-iks-cluster-name-or-id
+ DEPLOYMENT_NAME: iks-test
+ PORT: 5001
+
+jobs:
+ setup-build-publish-deploy:
+ name: Setup, Build, Publish, and Deploy
+ runs-on: ubuntu-latest
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ # Download and Install IBM Cloud CLI
+ - name: Install IBM Cloud CLI
+ run: |
+ curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
+ ibmcloud --version
+ ibmcloud config --check-version=false
+ ibmcloud plugin install -f kubernetes-service
+ ibmcloud plugin install -f container-registry
+
+ # Authenticate with IBM Cloud CLI
+ - name: Authenticate with IBM Cloud CLI
+ run: |
+ ibmcloud login --apikey "${IBM_CLOUD_API_KEY}" -r "${IBM_CLOUD_REGION}" -g default
+ ibmcloud cr region-set "${IBM_CLOUD_REGION}"
+ ibmcloud cr login
+
+ # Build the Docker image
+ - name: Build with Docker
+ run: |
+ docker build -t "$REGISTRY_HOSTNAME"/"$ICR_NAMESPACE"/"$IMAGE_NAME":"$GITHUB_SHA" \
+ --build-arg GITHUB_SHA="$GITHUB_SHA" \
+ --build-arg GITHUB_REF="$GITHUB_REF" .
+
+ # Push the image to IBM Container Registry
+ - name: Push the image to ICR
+ run: |
+ docker push $REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA
+
+ # Deploy the Docker image to the IKS cluster
+ - name: Deploy to IKS
+ run: |
+ ibmcloud ks cluster config --cluster $IKS_CLUSTER
+ kubectl config current-context
+ kubectl create deployment $DEPLOYMENT_NAME --image=$REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA --dry-run -o yaml > deployment.yaml
+ kubectl apply -f deployment.yaml
+ kubectl rollout status deployment/$DEPLOYMENT_NAME
+ kubectl create service loadbalancer $DEPLOYMENT_NAME --tcp=80:$PORT --dry-run -o yaml > service.yaml
+ kubectl apply -f service.yaml
+ kubectl get services -o wide
diff --git a/ci/laravel.yml b/ci/laravel.yml
index 7fc4665..a895246 100644
--- a/ci/laravel.yml
+++ b/ci/laravel.yml
@@ -16,7 +16,7 @@ jobs:
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
- run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
+ run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
diff --git a/ci/node.js.yml b/ci/node.js.yml
index e772a1c..673bd33 100644
--- a/ci/node.js.yml
+++ b/ci/node.js.yml
@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
- node-version: [10.x, 12.x]
+ node-version: [10.x, 12.x, 14.x]
steps:
- uses: actions/checkout@v2
diff --git a/ci/properties/dotnet-core-desktop.properties.json b/ci/properties/dotnet-core-desktop.properties.json
new file mode 100644
index 0000000..9b2aa35
--- /dev/null
+++ b/ci/properties/dotnet-core-desktop.properties.json
@@ -0,0 +1,6 @@
+{
+ "name": ".NET Core Desktop",
+ "description": "Build, test, sign and publish a desktop application built on .NET Core.",
+ "iconName": "dotnetcore",
+ "categories": ["C#", "Visual Basic", "WPF", ".NET"]
+}
\ No newline at end of file
diff --git a/ci/properties/ibm.properties.json b/ci/properties/ibm.properties.json
new file mode 100644
index 0000000..25ebf8a
--- /dev/null
+++ b/ci/properties/ibm.properties.json
@@ -0,0 +1,6 @@
+{
+ "name": "Deploy to IBM Cloud Kubernetes Service",
+ "description": "Build a docker container, publish it to IBM Cloud Container Registry, and deploy to IBM Cloud Kubernetes Service.",
+ "iconName": "ibm",
+ "categories": null
+}
diff --git a/ci/properties/wpf-dotnet-core.properties.json b/ci/properties/wpf-dotnet-core.properties.json
deleted file mode 100644
index f43ea35..0000000
--- a/ci/properties/wpf-dotnet-core.properties.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "WPF .NET Core",
- "description": "Build, test and publish a Wpf application built on .NET Core.",
- "iconName": "dotnetcore",
- "categories": ["C#", "Visual Basic", "WPF", ".NET"]
-}
\ No newline at end of file
diff --git a/ci/python-app.yml b/ci/python-app.yml
index 900e442..c7f5067 100644
--- a/ci/python-app.yml
+++ b/ci/python-app.yml
@@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- uses: actions/setup-python@v1
+ uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
diff --git a/ci/python-package.yml b/ci/python-package.yml
index b425371..f1abc2f 100644
--- a/ci/python-package.yml
+++ b/ci/python-package.yml
@@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
+ uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
diff --git a/ci/python-publish.yml b/ci/python-publish.yml
index d5f3859..4e1ef42 100644
--- a/ci/python-publish.yml
+++ b/ci/python-publish.yml
@@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
- uses: actions/setup-python@v1
+ uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
diff --git a/ci/rust.yml b/ci/rust.yml
index 6738b0b..3c13d1b 100644
--- a/ci/rust.yml
+++ b/ci/rust.yml
@@ -6,6 +6,9 @@ on:
pull_request:
branches: [ master ]
+env:
+ CARGO_TERM_COLOR: always
+
jobs:
build:
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/icons/ibm.svg b/icons/ibm.svg
new file mode 100644
index 0000000..7139661
--- /dev/null
+++ b/icons/ibm.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/script/sync-ghes/exec.ts b/script/sync-ghes/exec.ts
new file mode 100644
index 0000000..e529324
--- /dev/null
+++ b/script/sync-ghes/exec.ts
@@ -0,0 +1,42 @@
+import { spawn } from "child_process";
+
+export class ExecResult {
+ stdout = "";
+ exitCode = 0;
+}
+
+/**
+ * Executes a process
+ */
+export async function exec(
+ command: string,
+ args: string[] = [],
+ allowAllExitCodes: boolean = false
+): Promise {
+ process.stdout.write(`EXEC: ${command} ${args.join(" ")}\n`);
+ return new Promise((resolve, reject) => {
+ const execResult = new ExecResult();
+ const cp = spawn(command, args, {});
+
+ // STDOUT
+ cp.stdout.on("data", (data) => {
+ process.stdout.write(data);
+ execResult.stdout += data.toString();
+ });
+
+ // STDERR
+ cp.stderr.on("data", (data) => {
+ process.stderr.write(data);
+ });
+
+ // Close
+ cp.on("close", (code) => {
+ execResult.exitCode = code;
+ if (code === 0 || allowAllExitCodes) {
+ resolve(execResult);
+ } else {
+ reject(new Error(`Command exited with code ${code}`));
+ }
+ });
+ });
+}
diff --git a/script/sync-ghes/index.ts b/script/sync-ghes/index.ts
new file mode 100755
index 0000000..ea347cf
--- /dev/null
+++ b/script/sync-ghes/index.ts
@@ -0,0 +1,184 @@
+#!/usr/bin/env npx ts-node
+import { promises as fs } from "fs";
+import { safeLoad } from "js-yaml";
+import { basename, extname, join } from "path";
+import { exec } from "./exec";
+
+interface WorkflowDesc {
+ folder: string;
+ id: string;
+ iconName?: string;
+ iconType?: "svg" | "octicon";
+}
+
+interface WorkflowProperties {
+ name: string;
+
+ description: string;
+
+ iconName?: string;
+
+ categories: string[] | null;
+}
+
+interface WorkflowsCheckResult {
+ compatibleWorkflows: WorkflowDesc[];
+ incompatibleWorkflows: WorkflowDesc[];
+}
+
+async function checkWorkflows(
+ folders: string[],
+ enabledActions: string[]
+): Promise {
+ const result: WorkflowsCheckResult = {
+ compatibleWorkflows: [],
+ incompatibleWorkflows: [],
+ };
+
+ for (const folder of folders) {
+ const dir = await fs.readdir(folder, {
+ withFileTypes: true,
+ });
+
+ for (const e of dir) {
+ if (e.isFile()) {
+ const workflowFilePath = join(folder, e.name);
+ const workflowId = basename(e.name, extname(e.name));
+ const workflowProperties: WorkflowProperties = require(join(
+ folder,
+ "properties",
+ `${workflowId}.properties.json`
+ ));
+ const iconName: string | undefined = workflowProperties["iconName"];
+
+ const isBlankTemplate = workflowId === "blank";
+ const partnerWorkflow = workflowProperties.categories === null;
+
+ const enabled =
+ (isBlankTemplate || !partnerWorkflow) &&
+ (await checkWorkflow(workflowFilePath, enabledActions));
+
+ const workflowDesc: WorkflowDesc = {
+ folder,
+ id: workflowId,
+ iconName,
+ iconType:
+ iconName && iconName.startsWith("octicon") ? "octicon" : "svg",
+ };
+
+ if (!enabled) {
+ result.incompatibleWorkflows.push(workflowDesc);
+ } else {
+ result.compatibleWorkflows.push(workflowDesc);
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+/**
+ * Check if a workflow uses only the given set of actions.
+ *
+ * @param workflowPath Path to workflow yaml file
+ * @param enabledActions List of enabled actions
+ */
+async function checkWorkflow(
+ workflowPath: string,
+ enabledActions: string[]
+): Promise {
+ // Create set with lowercase action names for easier, case-insensitive lookup
+ const enabledActionsSet = new Set(enabledActions.map((x) => x.toLowerCase()));
+
+ try {
+ const workflowFileContent = await fs.readFile(workflowPath, "utf8");
+ const workflow = safeLoad(workflowFileContent);
+
+ for (const job of Object.keys(workflow.jobs || {}).map(
+ (k) => workflow.jobs[k]
+ )) {
+ for (const step of job.steps || []) {
+ if (!!step.uses) {
+ // Check if allowed action
+ const [actionName, _] = step.uses.split("@");
+ if (!enabledActionsSet.has(actionName.toLowerCase())) {
+ console.info(
+ `Workflow ${workflowPath} uses '${actionName}' which is not supported for GHES.`
+ );
+ return false;
+ }
+ }
+ }
+ }
+
+ // All used actions are enabled 🎉
+ return true;
+ } catch (e) {
+ console.error("Error while checking workflow", e);
+ throw e;
+ }
+}
+
+(async function main() {
+ try {
+ const settings = require("./settings.json");
+
+ const result = await checkWorkflows(
+ settings.folders,
+ settings.enabledActions
+ );
+
+ console.group(
+ `Found ${result.compatibleWorkflows.length} starter workflows compatible with GHES:`
+ );
+ console.log(
+ result.compatibleWorkflows.map((x) => `${x.folder}/${x.id}`).join("\n")
+ );
+ console.groupEnd();
+
+ console.group(
+ `Ignored ${result.incompatibleWorkflows.length} starter-workflows incompatible with GHES:`
+ );
+ console.log(
+ result.incompatibleWorkflows.map((x) => `${x.folder}/${x.id}`).join("\n")
+ );
+ console.groupEnd();
+
+ console.log("Switch to GHES branch");
+ await exec("git", ["checkout", "ghes"]);
+
+ // In order to sync from master, we might need to remove some workflows, add some
+ // and modify others. The lazy approach is to delete all workflows first, and then
+ // just bring the compatible ones over from the master branch. We let git figure out
+ // whether it's a deletion, add, or modify and commit the new state.
+ console.log("Remove all workflows");
+ await exec("rm", ["-fr", ...settings.folders]);
+ await exec("rm", ["-fr", "../../icons"]);
+
+ console.log("Sync changes from master for compatible workflows");
+ await exec("git", [
+ "checkout",
+ "master",
+ "--",
+ ...Array.prototype.concat.apply(
+ [],
+ result.compatibleWorkflows.map((x) => {
+ const r = [
+ join(x.folder, `${x.id}.yml`),
+ join(x.folder, "properties", `${x.id}.properties.json`),
+ ];
+
+ if (x.iconType === "svg") {
+ r.push(join("../../icons", `${x.iconName}.svg`));
+ }
+
+ return r;
+ })
+ ),
+ ]);
+ } catch (e) {
+ console.error("Unhandled error while syncing workflows", e);
+ process.exitCode = 1;
+ }
+})();
diff --git a/script/sync-ghes/package-lock.json b/script/sync-ghes/package-lock.json
new file mode 100644
index 0000000..ebcd318
--- /dev/null
+++ b/script/sync-ghes/package-lock.json
@@ -0,0 +1,112 @@
+{
+ "name": "sync-ghes-actions",
+ "version": "1.0.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@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"
+ }
+ },
+ "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/sync-ghes/package.json b/script/sync-ghes/package.json
new file mode 100644
index 0000000..c3c9872
--- /dev/null
+++ b/script/sync-ghes/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "sync-ghes-actions",
+ "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": {
+ "js-yaml": "^3.13.1"
+ }
+}
diff --git a/script/sync-ghes/settings.json b/script/sync-ghes/settings.json
new file mode 100644
index 0000000..050ea0a
--- /dev/null
+++ b/script/sync-ghes/settings.json
@@ -0,0 +1,20 @@
+{
+ "folders": [
+ "../../ci",
+ "../../automation"
+ ],
+ "enabledActions": [
+ "actions/checkout",
+ "actions/create-release",
+ "actions/delete-package-versions",
+ "actions/download-artifact",
+ "actions/setup-dotnet",
+ "actions/setup-go",
+ "actions/setup-java",
+ "actions/setup-node",
+ "actions/stale",
+ "actions/starter-workflows",
+ "actions/upload-artifact",
+ "actions/upload-release-asset"
+ ]
+}
diff --git a/script/sync-ghes/tsconfig.json b/script/sync-ghes/tsconfig.json
new file mode 100644
index 0000000..7c50a20
--- /dev/null
+++ b/script/sync-ghes/tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "compilerOptions": {
+ },
+ "include": ["*.ts"]
+}
\ 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