Skip to content

Update from Original Repository #21

Update from Original Repository

Update from Original Repository #21

name: Update from Original Repository
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
update-files:
runs-on: ubuntu-latest
steps:
# Check out the target repository (your repo)
- name: Checkout Target Repository
uses: actions/checkout@v3
with:
ref: main # Use the main branch for testing
# Remove any leftover submodule configurations
- name: Cleanup Submodule Configurations
run: |
git submodule deinit -f --all || true
rm -f .gitmodules
git config --remove-section submodule || true
# Clone the original repository
- name: Clone Original Repository
run: |
echo "original-repo/" >> .gitignore # Ignore the cloned directory
git clone --depth 1 https://github.com/community-scripts/ProxmoxVE original-repo
rm -rf original-repo/.git # Remove Git metadata to prevent submodule errors
# Copy and modify the necessary files
- name: Sync and Modify Files
run: |
mkdir -p ct install misc
cp original-repo/ct/create_lxc.sh ct/create_lxc.sh
cp original-repo/ct/pihole.sh ct/piblocklxc.sh
cp original-repo/install/pihole-install.sh install/piblocklxc-install.sh
cp original-repo/misc/build.func misc/build.func
cp original-repo/misc/install.func misc/install.func
# Run the shell script to modify piblocklxc-install.sh
- name: Run Custom Script for Modifications
run: bash misc/update_piblocklxc.sh
# Replace backtitles in build.func
- name: Update build.func
run: |
sed -i 's/--backtitle "Proxmox VE Helper Scripts"/--backtitle "PiBlockLXC"/g' misc/build.func
sed -i '/description()/,/# Generate LXC Description/c\description() {\n IP=$(pct exec "$CTID" ip a s dev eth0 | awk '\''/inet / {print $2}'\'' | cut -d/ -f1)\n\n DESCRIPTION=$(cat <<EOF\n<div align='\''center'\''><a href='\''https://Helper-Scripts.com'\'' target='\''_blank'\'' rel='\''noopener noreferrer'\''><img src='\''https://raw.githubusercontent.com/mschabhuettl/PiBlockLXC/main/misc/images/logo-90x112.png'\''/></a>\n\n # ${APP} LXC\n </div>\nEOF\n)\n}' misc/build.func
# Replace URLs in install.func
- name: Update install.func
run: |
sed -i 's|https://github.com/community-scripts/ProxmoxVE|https://github.com/mschabhuettl/PiBlockLXC|g' misc/install.func
sed -i 's|https://helper-scripts.com|https://github.com/mschabhuettl/PiBlockLXC|g' misc/install.func
# Commit and push changes directly to main
- name: Commit and Push Changes
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git commit -m "Update from Original Repository" || echo "No changes to commit"
git push origin main