Skip to content

Commit

Permalink
๐Ÿ–Š๏ธ improve content
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultleouay committed Feb 27, 2025
1 parent e6b0858 commit 97f232f
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions apps/web/src/content/posts/how-we-build-our-github-action.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: How We Built our own GitHub Action
description:
Learn how we built our own custom Docker GitHub Action to run OpenStatus Synthetics Tests on every push to our main branch and on a schedule.
A speedrun on building our own custom Docker GitHub Action to run OpenStatus Synthetics Tests on every push to our main branch and on a schedule.
author:
name: Thibault Le Ouay Ducasse
url: https://bsky.app/profile/thibaultleouay.dev
Expand All @@ -11,21 +11,25 @@ image: /assets/posts/how-we-build-our-github-action/GitHub.png
tag: engineering
---

Couple of weeks ago, when we released our CLI. We wanted to use it to run our own Synthetics Tests in a GitHub Action. We wanted to have a simple way to run our tests on every push to our main branch or on schedule.
A couple of weeks ago, when we released our CLI, we wanted to use it to run our own Synthetics Tests in a GitHub Action. We aimed to have a simple way to run our tests on every push to our main branch or on a schedule.


There's 3 ways to build a github action
There are three ways to build a GitHub Action:

- Composite actions
- Javascript actions
- Docker container actions


Our CLI is built in Golang, and publish every version as a binary. It made sense to go with the Docker container actions.
Our CLI is built in Golang, and we publish every new version as a binary. It made sense to go with the Docker container actions.
This way we could use our CLI to run the tests.

We needed to have a way to pass the API key and the configuration file to the action.


Let's start our speedrun on building our own custom Docker GitHub Action.

### Create a Dockerfile

Our Docker file is pretty simple. We use the alpine image and install curl to download the CLI. We then extract the CLI and set the entrypoint to the entrypoint.sh file.


Expand All @@ -45,7 +49,16 @@ RUN tar -xf ./cli.tar.gz
ENTRYPOINT ["/home/openstatus/entrypoint.sh"]
```

Our entrypoint.sh file is also pretty simple. We just run the CLI with the API key and the configuration file.
It results in a small image of around 25 MB, which is perfect for a GitHub Action.

To download the latest version of the CLI we use the following URL.

```
https://github.com/openstatusHQ/cli/releases/latest/download/cli_Linux_x86_64.tar.gz
```


Our entrypoint.sh file is also quite simple. We just run the CLI with the API key and the configuration file.

```bash
#!/bin/sh
Expand All @@ -66,6 +79,8 @@ else
fi
```

### Create the action.yml file

Our action.yml file

```yaml
Expand Down Expand Up @@ -111,6 +126,15 @@ To:
image: docker://ghcr.io/openstatushq/action:latest
```
### Publish it to the GitHub marketplace
Add branding to your action and your action is ready. You can publish it to the GitHub Marketplace.
### Conclusion
Building a GitHub Action is pretty simple. We choose to use a Docker container action because we wanted to use our CLI to run the tests.
If you want to start using our action you can find it in the GitHub Marketplace.
Expand All @@ -125,4 +149,4 @@ If you want to see a GitHub repository with the action you can find it here.
)
Create an account on [OpenStatus](/app/sign-in?ref=blog-github-action) and start running your own Synthetics Tests in your
_Create an account on [OpenStatus](/app/sign-in?ref=blog-github-action) and start running your own Synthetics Tests in your GitHub Actions._

0 comments on commit 97f232f

Please sign in to comment.