Build Filters AGH #65
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: Build Filters AGH | |
on: | |
# Schedule updates (4 hours) | |
schedule: [{cron: "0 */6 * * *"}] | |
# Lines below let you run workflow manually and on each commit | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: pip | |
- name: Install Python dependencies | |
run: pip install -r requirements.txt | |
- name: Set Git user identity | |
run: | | |
git config --global user.name "${{ secrets.GIT_USER_NAME }}" | |
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Execute script AGH_Whitelist.py | |
run: | | |
cd AGH/ | |
chmod +x AGH_Whitelist.py | |
python3 ./AGH_Whitelist.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Execute script AGH_filters.py | |
run: | | |
cd AGH/ | |
chmod +x AGH_filters.py | |
python3 ./AGH_filters.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Execute script AGH_filters+.py | |
run: | | |
cd AGH/ | |
chmod +x AGH_filters+.py | |
python3 ./AGH_filters+.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Apply changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git add AGH/hosts.txt AGH/filters/whitelist/whitelist.txt AGH/AGH_Host+.txt | |
# Check for changes in the staging area before attempting to commit. | |
if git diff --cached --quiet; then | |
echo "There are no changes to the selected files, nothing to do." | |
else | |
git commit -m "Updating files from GitHub Actions" | |
git push origin main | |
fi |