Composite GitHub Action to commit and push changes back to repository after Jekyll build or other generation steps. Includes optional Telegram notifications with git diff summary. Uses github-actions[bot] for traceable commits.
- Conditionally commits only if changes detected via
git diff --cached - Safe git config with GitHub bot credentials
- Telegram notifications with git status, commit message, and truncated file changes (MarkdownV2)
- Strict bash mode (
set -euo pipefail) for reliability - Custom commit message with label and timestamp
- Handles large diffs by limiting to 20 lines + "..."
Action assumes prior actions/checkout@v4 with write permissions. Repository must allow pushes from github-actions[bot] (default for most repos). For protected branches, enable "Allow GitHub Actions to create and approve pull requests".
name: Build & Backpush
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate Jekyll site
run: |
# Your build steps here, e.g.:
bundle exec jekyll build
- name: Commit & Push
uses: jekyll-is/action-jekyll-is-backpush
with:
label: "Jekyll build"Store TELEGRAM_BOT_TOKEN and TELEGRAM_USER_ID as repository secrets.
- name: Commit & Push
uses: jekyll-is/action-jekyll-is-backpush
with:
label: "Jekyll build"
telegram-bot-token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
telegram-user-id: ${{ secrets.TELEGRAM_USER_ID }}| Input | Description | Required | Default |
|---|---|---|---|
label |
Text label for commit messages/notifications | ✅ Yes | - |
telegram-bot-token |
Telegram bot token (secrets recommended) | ❌ No | - |
telegram-user-id |
Telegram user/chat ID | ❌ No | - |
Currently none. Future versions may add changes-detected: true/false.
Full example for Jekyll site with generated static files:
name: Jekyll CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- run: bundle exec jekyll build
- name: Backpush _site changes
uses: jekyll-is/action-jekyll-is-backpush
with:
label: "Jekyll ${_site}"
telegram-bot-token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
telegram-user-id: ${{ secrets.TELEGRAM_USER_ID }}See detailed analysis in CHANGELOG.md or issues.
- No automatic
git pull(add before if needed) - Telegram message may exceed 4096 chars on large changes
- Selective
git addrecommended (e.g.,git add _site/instead ofgit add .)
- Fork/clone repository
- Test locally:
act -j test(requiresnektos/act) - Add
.github/workflows/test.ymlfor CI validation - Tag releases:
git tag v1.0.0 && git push --tags
Testing workflow example:
name: Test Backpusher
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: touch test-file.txt # Simulate change
- uses: jekyll-is/action-jekyll-is-backpush
with:
label: "Test"GPLv3. See LICENSE for details.