Skip to content

Plagiatus/RCON-Action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

RCON-Action

Integrate RCON actions into your github workflow.

Originally created and intended to be used for a more automated use of minecraft datapacks, in tandem with the FTP Deploy action. See this file for a working example of a combination of these two.

To set up with your Minecraft Server via FTP, copy the linked example file to your_repository/.github/workflow/main.yml, update and add the secrets to your repository and you're ready to go. That is if your server has both FTP and RCON enabled.

Example Action File

File in this repository

name: RCON Test

on: 
  push:
    branches: [ main ]

  workflow_dispatch:

jobs:
  rcon_test:
    runs-on: ubuntu-latest
    name: RCON Test
    steps:
      - name: RCON Connection
        uses: Plagiatus/RCON-Action@v0.2
        with:
          server: ${{ secrets.rcon_server }}
          port: ${{ secrets.rcon_port }}
          password: ${{ secrets.rcon_password }}
          commands: '["say hi", "reload"]'

Available Arguments

name required description default example
server yes The server IP 127.0.0.1
port no The RCON port 25575 12345
password no The password "" Sj3%ka"l
commands no Additional commands you want to run, in the form of a JSON String Array '["say hi", "reload"]'
send-push-info no Whether a tellraw informing about the push should be sent true
push-info-recipient no Changes the selector of the push info tellraw. @a @a[tag=admin]

It is highly recommended to use github secrets instead of plaintext inclusions for more sensitive data like the IP or the password.

Using environment variables

You can use env variables to your hearts content, you just need to use context properties notation.

Examples:

Runtime variables:

commands: '["say actor ${{ github.actor }}"]'

image

Custom Variables:

env:
  DAY_OF_WEEK: Monday

...
commands: '["say day ${{ env.DAY_OF_WEEK }}"]'

image

Credits