Update from Original Repository #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: test-update-branch # Specify the branch to test changes | |
# 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: | | |
# Copy files from the original repository | |
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 | |
# Apply modifications to piblocklxc.sh (update header_info function) | |
sed -i 's/____ ____ __ ______ __ ______/____ _ ____ __ __ __ _ ________/g' ct/piblocklxc.sh | |
# Add custom logic before motd_ssh in piblocklxc-install.sh | |
sed -i '/motd_ssh/i # Prompt user to decide whether to install pihole-updatelists\nread -r -p "Would you like to add pihole-updatelists? <Y/n> " prompt\nif [[ -z "$prompt" || ${prompt,,} =~ ^(y|yes)$ ]]; then\n # Installing necessary PHP packages\n $STD apt-get install -y php-cli php-sqlite3 php-intl php-curl sqlite3\n # Additional commands here\nfi' install/piblocklxc-install.sh | |
# Replace backtitles in build.func | |
sed -i 's/--backtitle "Proxmox VE Helper Scripts"/--backtitle "PiBlockLXC"/g' misc/build.func | |
# Replace URLs in install.func | |
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 to the test branch | |
- name: Commit and Push Changes | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git checkout -b test-update-branch || git checkout test-update-branch | |
git add . | |
git commit -m "Update from Original Repository (Test)" || echo "No changes to commit" | |
git push --set-upstream origin test-update-branch |