Skip to main content

Auto Executing Github Actions with update on Contents data.


This tutorial explains how to setup and run GitHub actions on updation of Content. This also covers dispatch action with ApprovalFlow and via API.

What you’ll learn

Run GitHub actions when a content is updated, you will need to:

Before you start

To use this tutorial, you should have already built your project with Kuroco and Nuxt.js and created a contents list page and configured Kuroco . If you have not yet done so, refer to the tutorials below:

This tutorial explains how to run GitHub actions when a content is updated with ApprovalFlow.

Configure GitHub Workflow

After you have connected to GitHub and setup the actions YAML file along with Kuroco Select, your GitHub setting screen should look like this.

Image from Gyazo


For GitHub Actions to work, the Workflow needs to be configured on GitHub Connection screen. Without that, Even if the Workflow is linked on the Content, it will not execute GitHub Actions.

You need to set the Workflow and Target branch here. Select the corresponding things based on your GitHub repository and click Update.

Image from Gyazo

Create Content with GitHub Actions

Click on Contents from the side menu and select the Content Structure you want to link the Action to and click Add. You can also edit any existing content if you want to link Action Workflow with existing data, in that case it will run the GitHub Action after you have updated the Content.

Image from Gyazo

You need to select Workflow as Link value. Image from Gyazo

Once updated with Workflow as Link, you can see that the GitHub Actions is executed. Image from Gyazo

(Optional) Create Content with Approvalflow Workflow as well

GitHub actions can automatically run when a content is updated. If the workflow is configured on that content then the Action will run when the workflow is completed (all groups have approved and the content is published/updated).

1. Create a Workflow

To create a workflow, on the Side Menu, navigate to [Operation] > [Approval Workflow]. Here you can add a new workflow or edit if already created.

Image from Gyazo

Then proceed to filling required information about the Workflow you want to set.

Image from Gyazo

2. Configure Flow Settings

You need to set the flow settings on the path from create/update to published of any content.

Image from Gyazo

After the configuration of Workflow. You can proceed to content edit.

3. Create a new topic.

You need to Navigate to [Content] > Content Name. From there you can click on [Add] to create a new content.

Image from Gyazo

4. Set GitHub Workflow and Approvalflow.

GitHub Workflow needs to be linked in order for the GitHub Action to be executed after the content is published. Therefore, Linking of GitHub Workflow is mandatory. You can optionally link Approvalflow Workflow if you want Approval before publishing of that content.

Image from Gyazo

5. Update the Content

If the content is set with Approvalflow Workflow, then it will move to Pending Approval, otherwise it will be directly published and the GitHub Action will be executed.

Image from Gyazo

6. Confirm GitHub Actions run.

After setting of the Content, GitHub actions will run. They can be confirmed on GitHub as well on the Actions Tab.

Image from Gyazo Image from Gyazo

Create Content with API

With Headless Approach, the GitHub action can be configured to be executed when the content is updated, even when doing so via APIs. For this tutorial's simplicity, we will be using Contents API without Approvalflow. Documentation on adding content with Approvalflow can be found here.

1. Create a Content insert API.

Go to the [API] and select the API from the side menu. Click on Add to Add a new Engpoint. You can enter information according to the following reference table.

Image from Gyazo

PathThe Path of Endpoint. You can fill according to your requirement.
Model - CategorySelect Content
Model - ModelSelect Topics with version 1 (That is latest currently).
Model - OperationSelect the operation which you want to perform on the content.
topics_group_idEnter the topics ID of Content.
For this example, we are using insert operation.

2. Send the Request.

To check the endpoint, you can go to Swagger UI. Select the newly created endpoing and click on Test. Here, if you pass dispatch_github_workflow with value as 1. This would configure content to execute GitHub action when it is published. If approvalflow is used, then the Action will be executed after Approvalflow is completed. If the content is set to unpublish or to be published at a later date then the GitHub Action will be executed only when the content is published. For simplicity of this tutorial, we will pass open_flg as 1 which would set the content to be published immediately on insert which would trigger the GitHub Action immediately on insertion of the content.

Image from Gyazo

Here, we can see on the response that the content is added successfully.

Image from Gyazo

You can also go to that particular content list and confirm that the contend is updated. (In this case, inserted)

Image from Gyazo

3. Confirm GitHub Actions run

You can navigate to GitHub repository's Actions tab and confirm that the action is executed.

Image from Gyazo


If you have any other questions, please contact us or check out Our Slack Community.