This guide provides essential Git commands and best practices for contributing to the RPZ-Blocklists repository. It is designed for developers contributing via feature or patch branches, with frequent automated updates from the GitHub Actions workflow.
Install Git (Linux):
sudo apt install gitFor other operating systems, use the appropriate package manager or installer.
git config --global user.name "Your Name"
git config --global user.email "[email protected]"To run the provided Perl scripts locally, you can install the required Perl modules with this command:
cpan install LWP::UserAgent LWP::Protocol::https IO::Socket::SSL Text::CSV JSON XML::Simple URI Getopt::Long POSIX File::Basename File::PathOr, with cpanm (if available):
cpanm LWP::UserAgent LWP::Protocol::https IO::Socket::SSL Text::CSV JSON XML::Simple URI Getopt::Long POSIX File::Basename File::PathNote: Working directly on main is discouraged. Always create a feature or patch branch for your changes and use Pull Requests to merge into main.
- Clone the Repository
git clone https://github.com/twitOne/RPZ-Blocklists.git
cd RPZ-Blocklists- Update Your Local main
Before starting new work, ensure your local main is up to date and Pull Latest Changes
git pull --rebase origin main- Create a New Branch
Name your branch according to the feature or fix you are working on:
git checkout -b feature/your-feature-name
# or for bugfixes:
git checkout -b patch/your-fix-description
- Make and Test Your Changes
Edit and test your files locally as needed:
# Edit files, e.g.:
vim tools/urllist.txt
# Test locally
perl tools/blocklist2rpz-multi.pl -w -d ./ -l tools/urllist.txt -m tools/list-mappings.csv- Commit Your Changes
git add .
git commit -m "Descriptive message (e.g., Add new blocklist source)"- Push Your Branch to Github
For the first push of a new branch, set the upstream:
git push -u origin feature/your-feature-nameFor subsequent pushes, simply use:
git pushor use the pushup alias (see below).
Note: When working on a feature or patch branch, you can use the following alias to update your branch with the latest changes from main and push it safely:
git config --global alias.pushup '!git fetch origin && git rebase origin/main && git push origin HEAD'Now you can update and push your branch with a single command:
git pushupThis ensures your branch is up to date before pushing and avoids conflicts with frequent workflow commits on main. Always create a Pull Request to merge your branch into main after pushing.
- Create a Pull Request
After pushing your branch, open a Pull Request on GitHub to merge your branch into main. Request a review if needed. Only after approval and successful checks should the changes be merged.
If you must work directly on main, set up this alias to avoid "fetch first" errors due to frequent workflow commits:
git config --global alias.pushup '!git pull --rebase origin main && git push origin main'After committing, run:
git pushupThe workflow updates .rpz files hourly, so conflicts are rare unless you edit the same files (e.g., urllist.txt).
If git pull --rebase fails:
- Resolve conflicts in the marked files (
<<<<<<<,=======,>>>>>>>). - Continue with:
git add <file> git rebase --continue git push origin <your-branch>
- Pull Frequently: Run
git pull --rebase origin mainbefore editing to stay in sync. - Commit Often: Small, focused commits with clear messages (e.g., “Update README with guide”).
- Test Locally: Validate changes with the Perl script before pushing.
- Avoid Force Push: Never use
git push --forcein this repo to prevent overwriting workflow commits. - Check Workflow Logs: After pushing, verify the GitHub Actions run in the “Actions” tab.
You can test and run GitHub Actions workflows locally using the act tool.
By default, act requires Docker to simulate the GitHub Actions environment. If you do not want to use Docker, you can run act in "self-hosted" mode, but this comes with limitations (no isolation, some actions may not work as expected)
# Run act with Docker (recommended)
act
# Run act without Docker (less isolation, may not work for all workflows)
act -P ubuntu-latest=-self-hosted- Make sure to install act and (for the default mode) Docker on your system.
- For more details, see the act documentation.
Note:
- Running workflows locally is helpful for debugging and developing workflows before pushing to GitHub.
- Some GitHub-hosted features may behave differently or be unavailable without Docker or in self-hosted mode.
The repository uses GitHub Actions to automatically update RPZ blocklists every hour. The workflow currently sets up Perl 5.36 and installs the following modules:
- LWP::UserAgent
- LWP::Protocol::https
- IO::Socket::SSL
- Text::CSV
- JSON
- XML::Simple
If you require additional modules, update both your local environment and the workflow configuration.
- The workflow commits to main hourly (e.g., commit 17c20fb), so always pull before pushing.
- Logs are in tools/logs/ (git-ignored) and available as rpz-logs artifacts in GitHub Actions.
- For questions, open an issue or ping the team.
Happy contributing!