How Can We Help?
Print

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 The Panel

Log into the Cybrancee panel and navigate to the “Account” setting located at the top.

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.

After, give your new API key a description and click “Create”.

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

3. Create GitHub Action Secret

Go to your GitHub repository and access the repository settings.

After accessing the settings, click on “Secrets and variables” and then click on “Actions” to view your GitHub actions Secrets.

Click on “New repository secret” to create a new secret, this will store your panel API key.

Now, Give your secret the name of “PTERODACTYL_API_KEY” and input your panel API key as the secret. Then you can click “Add secret” to save.

4. Create GitHub Action Variable

Now click on “Variables” to add your server ID to the action variables.

Once on the variables tab, click “New repository variable” to add a new variable.

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

5. Create a New GitHub Action

Click on the “Actions” tab to view repository actions.

Then click on “set up workflow yourself” to set up a custom action.

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

Then click “Commit changes” again to commit your changes.

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

Starts at $1.49 per Month

Discord Bot Hosting

Start Now