How to Automatically Restart Your Bot After Pushing Changes to GitHub

This guide will show you how to automatically restart your bot server after changes are made in GitHub. This is helpful as it will force all of the updates to automatically apply to your bot server.

This guide assumes you have already set up your bot to pull from GitHub. If you haven’t, a short guide can be found here: https://cybrancee.com/learn/knowledge-base/how-to-use-git-in-pterodactyl/.

1. Log in to Your Cybrancee Panel

Navigate to the ‘Account’ Tab.

Cybrancee panel servers, account outlined

2. Create an API Key

Click on the “Api Key” tab, located at the bottom of the page. This will show you your API keys.

Cybrancee panel account screen, with API Key tab outlined

After this, give your new API key a description and select ‘Create’.

Cybrancee panel account screen, with create button outlined

Once created, copy your API key, as you will not be able to access it later.

Cybrancee panel API key modal

3. Create a GitHub Action Secret

Go to your GitHub repository and access the repository settings.

GitHub repository settings

After accessing the settings, select ‘Secrets and variables’ and then select ‘Actions’ to view your GitHub actions Secrets.

GitHub repository actions

Click ‘New repository secret’ to create a new secret, this will store your panel API key.

Github new repository secret option

Now, give your secret the name of ‘PTERODACTYL_API_KEY’ and input your panel API key as the secret. Then you can select ‘Add secret’ to save.

Github new repository secret option

4. Create a GitHub Action Variable

Now select ‘Variables’ to add your server ID to the action variables.

GitHub repo actions screen, with variables outlined

Once on the variables tab, select ‘New repository variable’ to add a new variable.

GitHub repo actions screen, with variables outlined

Now Give your variable the name of ‘SERVER_ID’ and Input your server ID as the variable. Then you can select ‘Add variable’ to save. Your server ID can be found from the ‘Dashboard’ page of the panel.

Github repository settings tab, new variable screen

5. Create a New GitHub Action

Select the ‘Actions’ tab to view repository actions.

Github repository settings tab, actions secrets and variables screen, with actions tab outlined

Then select ‘set up workflow yourself’ to set up a custom action.

Get started with Github actions page

Next, copy the code from the Cybrancee Bot-Restart-Action repository into your new action and select ‘Commit Changes’. The repository can be found here: https://github.com/Cybrancee/Bot-Restart-Action.

GitHub workflow, commit changes button and code outlined

Then select ‘Commit changes’ again to commit your changes.

GitHub workflow, commit changes modal

After committing, your bot should automatically restart due to the new commit.

Discord Bot Hosting

Was this article helpful?
Please Share Your Feedback
How Can We Improve This Article?
Table of Contents
Error Details*
Cancel