From 83be8f8dbc044a6e42e5f3827f703cb05bfecc7f Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 25 Feb 2024 15:28:55 +0000 Subject: [PATCH] Adds workflows to insert readme content --- .github/workflows/credits.yml | 24 ++--------- .github/workflows/insert-privacy-list.yml | 50 +++++++++++++++++++++++ 2 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/insert-privacy-list.yml diff --git a/.github/workflows/credits.yml b/.github/workflows/credits.yml index e2535de..84aad69 100644 --- a/.github/workflows/credits.yml +++ b/.github/workflows/credits.yml @@ -1,27 +1,11 @@ # Inserts list of contributors and community members into ./docs/credits.md -# Also generates an SVG showing all contributors, which is embedded into readme name: ๐Ÿ“Š Generate Contributor Credits on: workflow_dispatch: # Manual dispatch schedule: - cron: '0 5 * * 6' # Every Saturday morning. jobs: - # Job #1 - Generate an embedded SVG asset, showing all contributors - generate-contributors: - runs-on: ubuntu-latest - steps: - - uses: bubkoo/contributors-list@v1 - with: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - svgPath: .github/assets/CONTRIBUTORS.svg - affiliation: all - includeBots: false - excludeUsers: snyk-bot - avatarSize: 96 - userNameHeight: 20 - svgWidth: 830 - commitMessage: 'Updates contributor SVG' - # Job #2 - Inserts sponsors into credits page + # Job #1 - Inserts sponsors into README insert-sponsors: runs-on: ubuntu-latest steps: @@ -31,8 +15,8 @@ jobs: uses: JamesIves/github-sponsors-readme-action@1.0.5 with: token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - file: '.github/CREDITS.md' - # Job #3 - Inserts contributors into credits page + file: '.github/README.md' + # Job #2 - Inserts contributors into README insert-credits: runs-on: ubuntu-latest name: Inserts contributors into credits.md @@ -43,7 +27,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} with: image_size: 80 - readme_path: .github/CREDITS.md + readme_path: .github/README.md columns_per_row: 6 commit_message: 'Updates contributors list' committer_username: liss-bot diff --git a/.github/workflows/insert-privacy-list.yml b/.github/workflows/insert-privacy-list.yml new file mode 100644 index 0000000..60c5837 --- /dev/null +++ b/.github/workflows/insert-privacy-list.yml @@ -0,0 +1,50 @@ +name: ๐Ÿ“š Inserts Awesome Privacy into README + +on: + workflow_dispatch: + push: + branches: [ main ] + paths: ['awesome-privacy.yml'] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + # Get current date-time (used for commit message) + - name: Get Date ๐Ÿ“… + id: date + run: echo "::set-output name=date::$(date +'%d-%b-%Y')" + + # Downloads + installs Python (used for running gen scripts) + - name: Set up Python ๐Ÿ + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + # Install contents of requirements.txt + - name: Install dependencies ๐Ÿ“ฅ + run: | + python -m pip install --upgrade pip + cd lib && pip install -r requirements.txt + + # The make command triggers all the Python scripts, generates output + - name: Run make command ๐Ÿ”จ + run: python lib/awesome-privacy-readme-gen.py + + # Commit and push the outputed readme + - name: Commit and push generated files โคด๏ธ + run: | + git config --global user.name "Liss-Bot" + git config --global user.email "alicia-gh-bot@mail.as93.net" + git pull origin main + git add .github/README.md + if git diff --staged --quiet; then + echo "Nothin new added, so nothing to commit, exiting..." + else + git commit -m "Updated Awesome Privacy content (last modified on ${{ steps.date.outputs.date }})" + git push + fi