Introducing Reddit Scheduled Submit, a Python script that seamlessly integrates with GitHub Actions to automate your Reddit postings. With customizable titles and messages, you can easily schedule content to go live on your chosen subreddit. Say goodbye to manual submissions and streamline your Reddit engagement with this simple yet effective tool.
This repository contains a simple Python script that uses the PRAW (Python Reddit API Wrapper) library to post a message to Reddit.
It's designed to be easily integrated into GitHub Actions workflows.
To use this script, you need:
Clone this repository:
git clone https://github.com/meysam81/reddit-scheduled-submit
Install the required dependencies:
pip install -r requirements.txt
export REDDIT_CLIENT_ID="CHANGE_THIS"
export REDDIT_CLIENT_SECRET="CHANGE_THIS"
export REDDIT_USERNAME="CHANGE_THIS"
export REDDIT_PASSWORD="CHANGE_THIS"
export REDDIT_SUBREDDIT="CHANGE_THIS"
./main.py --title "Hello, Reddit!" --message "This is a test message."
To run the Docker container, you can use the following command:
docker run \
--rm \
--name reddit-scheduled-submit \
-e REDDIT_CLIENT_ID="CHANGE_THIS" \
-e REDDIT_CLIENT_SECRET="CHANGE_THIS" \
-e REDDIT_USERNAME="CHANGE_THIS" \
-e REDDIT_PASSWORD="CHANGE_THIS" \
-e REDDIT_SUBREDDIT="CHANGE_THIS" \
ghcr.io/meysam81/reddit-scheduled-submit:v1 \
--title "Hello, Reddit!" \
--message "This is a test message."
To use this script as a GitHub Action, you can create a workflow file (e.g.,
.github/workflows/ci.yml) with the following content:
name: ci
on:
workflow_dispatch:
inputs:
title:
description: Post title
required: true
message:
description: Post message
required: true
subreddit:
default: r/test
description: Subreddit to post to
required: false
jobs:
reddit-scheduled-submit:
runs-on: ubuntu-latest
steps:
- name: Post to Reddit
uses: meysam81/reddit-scheduled-submit@v1
with:
client-id: ${{ secrets.REDDIT_CLIENT_ID }}
client-secret: ${{ secrets.REDDIT_CLIENT_SECRET }}
username: ${{ secrets.REDDIT_USERNAME }}
password: ${{ secrets.REDDIT_PASSWORD }}
subreddit: ${{ github.event.inputs.subreddit }}
message: ${{ github.event.inputs.message }}
title: ${{ github.event.inputs.title }}
Make sure to set up the following secrets in your GitHub repository:
REDDIT_CLIENT_IDREDDIT_CLIENT_SECRETREDDIT_USERNAMEREDDIT_PASSWORDContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
This script is for educational purposes only. Make sure to comply with Reddit's API terms of service and posting guidelines when using this script.
No comments yet.
Sign in to be the first to comment.