From 5a107f0e656e6383d5dec4efe4f78edbc77d5f5d Mon Sep 17 00:00:00 2001 From: dkwon17 Date: Mon, 18 Sep 2023 21:04:47 +0000 Subject: [PATCH] Add devfile.yaml, .vscode/extensions.json, CONTRIBUTING.md Signed-off-by: dkwon17 Contributing guide Signed-off-by: dkwon17 --- .gitignore | 3 ++- .vscode/extensions.json | 8 +++++++ CONTRIBUTING.md | 53 +++++++++++++++++++++++++++++++++++++++++ devfile.yaml | 40 +++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 .vscode/extensions.json create mode 100644 CONTRIBUTING.md create mode 100644 devfile.yaml diff --git a/.gitignore b/.gitignore index ea25173..c8106a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ coverage .intellij .eclipse -.vscode +.vscode/* +!.vscode/extensions.json node_modules out yarn-error.log diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..7746a2d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "github.vscode-pull-request-github", + "sugatoray.vscode-git-extension-pack", + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4e31f25 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ +# Contributing guide + +## Getting started + +The following devfile tasks or npm commands can be used to perform common development tasks for this project. + +| **Devfile task** | **Npm command** | +|-------------------------------------------|--------------------------------------------------------------| +| Install dependencies | `npm i` | +| Run linter | `npm run lint` | +| Bundle (generate dist folder) | `npm run bundle` | +| Run tests | `npm run test` | +| Update GitHub action's inputs and outputs | `npx action-io-generator -o src/generated/inputs-outputs.ts` | + +## Upating the GitHub action's inputs and outputs +After updating the inputs or outputs in the `try-in-web-ide/action.yml` file, run the `Update GitHub action's inputs and outputs` task to generate the corresponding Typescript definition in `src/generated`. + +## Running new changes of the GitHub action within GitHub + +To run your new changes to the GitHub action, + +1. Run the `Bundle (generate dist folder)` devfile task, or run the `npm run bundle` command in the terminal. +2. Push the resulting `dist` folder to your fork: +``` +git push fork your-branch +``` +3. Create a private GitHub repository containing a file `.github/workflows/try-in-web-ide.yaml` with the following content: + +``` +name: try-in-web-ide + +on: + pull_request_target: + types: [opened, synchronize] + +jobs: + add-link: + runs-on: ubuntu-20.04 + steps: + - name: "Checkout source code" + uses: actions/checkout@v3 + - name: Eclipse Che Pull Request Link + id: che-pr-check-gh-action + uses: /try-in-web-ide@ + with: + github_token: ${{ secrets.GITHUB_TOKEN }} +``` +Replace `` and `` with your username and branch name. + +4. Create a PR against your private repository to run the GitHub action. + +## Making a PR +Before making a PR, ensure that you have ran the `Run linter`, `Bundle`, and `Run tests` tasks successfully. diff --git a/devfile.yaml b/devfile.yaml new file mode 100644 index 0000000..c7b643f --- /dev/null +++ b/devfile.yaml @@ -0,0 +1,40 @@ +schemaVersion: 2.2.0 +metadata: + name: try-in-web-ide +components: + - name: tools + container: + image: quay.io/devfile/universal-developer-image:ubi8-latest + mountSources: true + memoryLimit: 4Gi +commands: + - id: install-dependencies + exec: + label: "Install dependencies" + component: tools + workingDir: ${PROJECT_SOURCE} + commandLine: "npm i" + - id: run-linter + exec: + label: "Run linter" + component: tools + workingDir: ${PROJECT_SOURCE} + commandLine: "npm run lint" + - id: bundle + exec: + label: "Bundle (generate dist folder)" + component: tools + workingDir: ${PROJECT_SOURCE} + commandLine: "npm run bundle" + - id: run-tests + exec: + label: "Run tests" + component: tools + workingDir: ${PROJECT_SOURCE} + commandLine: "npm run test" + - id: update-action-input-output + exec: + label: "Update GitHub action's inputs and outputs" + component: tools + workingDir: ${PROJECT_SOURCE} + commandLine: "npx action-io-generator -o src/generated/inputs-outputs.ts"