.github/workflows/insert-privacy-list.yml

57 lines · 1794 bytes

 1name: 📚 Inserts Awesome Privacy into README
 2
 3on:
 4  workflow_dispatch:
 5  push:
 6    branches: [ main ]
 7    paths: ['awesome-privacy.yml']
 8    
 9jobs:
10  build:
11    runs-on: ubuntu-latest
12
13    steps:
14      - name: Checkout repository 🛎️
15        uses: actions/checkout@v5
16        with:
17          fetch-depth: 0
18
19      # Get current date-time (used for commit message)
20      - name: Get Date 📅
21        id: date
22        run: echo "date=$(date +'%d-%b-%Y')" >> "$GITHUB_OUTPUT"
23
24      # Downloads + installs Python (used for running gen scripts)
25      - name: Set up Python 🐍
26        uses: actions/setup-python@v5
27        with:
28          python-version: '3.x'
29          
30      # Install contents of requirements.txt
31      - name: Install dependencies 📥
32        run: |
33          python -m pip install --upgrade pip
34          cd lib && pip install -r requirements.txt
35
36      # The make command triggers all the Python scripts, generates output
37      - name: Generate README 🔨
38        run: python lib/awesome-privacy-readme-gen.py
39
40      - name: Generate changelog 📋
41        env:
42          GITHUB_TOKEN: ${{ github.token }}
43        run: python lib/generate-changelog.py
44
45      # Commit and push the outputed readme and changelog
46      - name: Commit and push generated files ⤴️
47        run: |
48          git config --global user.name "Liss-Bot"
49          git config --global user.email "alicia-gh-bot@mail.as93.net"
50          git pull origin main
51          git add .github/README.md .github/changelog.json
52          if git diff --staged --quiet; then
53            echo "Nothin new added, so nothing to commit, exiting..."
54          else
55            git commit -m "Updated Awesome Privacy content (last modified on ${{ steps.date.outputs.date }})"
56            git push
57          fi