Try in Web IDE GitHub action
The Try in Web IDE GitHub action can be added to a GitHub repository workflow to help reviewers quickly test pull requests on Eclipse Che hosted by Red Hat. The action achieves this by listening to pull request events and providing a factory URL by creating a comment, a status check, or both. This factory URL creates a new workspace from the pull request branch on Eclipse Che hosted by Red Hat.
The Che documentation repository (https://github.com/eclipse/che-docs) is a real-life example where the Try in Web IDE GitHub action helps reviewers quickly test pull requests. Experience the workflow by navigating to a recent pull request and opening a factory URL. |
Adding the action to a GitHub repository workflow
This section describes how to integrate the Try in Web IDE GitHub action to a GitHub repository workflow.
-
A GitHub repository
-
A devfile in the root of the GitHub repository.
-
In the GitHub repository, create a
.github/workflows
directory if it does not exist already. -
Create an
example.yml
file in the.github/workflows
directory with the following content:Example 1. example.ymlname: Try in Web IDE example on: pull_request_target: types: [opened] jobs: add-link: runs-on: ubuntu-20.04 steps: - name: Web IDE Pull Request Check id: try-in-web-ide uses: redhat-actions/try-in-web-ide@v1 with: # GitHub action inputs # required github_token: ${{ secrets.GITHUB_TOKEN }} # optional - defaults to true add_comment: true # optional - defaults to true add_status: true
This code snippet creates a workflow named
Try in Web IDE example
, with a job that runs thev1
version of theredhat-actions/try-in-web-ide
community action. The workflow is triggered on thepull_request_target
event, on theopened
activity type. -
Optionally configure the activity types from the
on.pull_request_target.types
field to customize when workflow trigger. Activity types such asreopened
andsynchronize
can be useful.Example 2. Triggering the workflow on bothopened
andsynchronize
activity typeson: pull_request_target: types: [opened, synchronize]
-
Optionally configure the
add_comment
andadd_status
GitHub action inputs withinexample.yml
. These inputs are sent to the Try in Web IDE GitHub action to customize whether comments and status checks are to be made.
Providing a devfile
Providing a devfile in the root directory of the repository is recommended to define the development environment of the workspace created by the factory URL. In this way, the workspace contains everything users need to review pull requests, such as plugins, development commands, and other environment setup.
The Che documentation repository devfile is an example of a well-defined and effective devfile.