Update rules database #1394
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 rules database | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
env: | |
PYTHON_VERSION: '3.11.1' | |
jobs: | |
update-and-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'poetry' | |
- name: Install requirements | |
run: poetry install | |
- name: Run the generator | |
id: generator | |
run: | | |
echo "EMBED_DESCRIPTION<<EOF" >> $GITHUB_ENV | |
echo "$(poetry run generator)" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Capture date | |
id: capture-date | |
run: | | |
echo "date=$(date -u)" >> $GITHUB_OUTPUT | |
- name: Push update | |
continue-on-error: true | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git commit -am "Update rules database '${{ steps.capture-date.outputs.date }}'" | |
git push origin main | |
- name: Send discord webhook | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.CARPET_RULES_WEBHOOK_URL }} | |
embed-title: "Carpet rules database stats" | |
embed-description: "${{ env.EMBED_DESCRIPTION }}" | |
embed-color: 0xf0932b | |
username: "Carpet Rules Generator" | |
avatar-url: ${{ secrets.CARPET_RULES_AVATAR_URL }} | |
content: "${{ steps.capture-date.outputs.date }}" |