Main #12483
This file contains hidden or 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: 'Main' | |
on: | |
pull_request: | |
branches: ['main'] | |
schedule: | |
- cron: '0 * * * *' # every hour | |
workflow_dispatch: | |
permissions: {} | |
jobs: | |
update: | |
name: 'Update' | |
runs-on: 'ubuntu-latest' | |
permissions: | |
contents: 'write' | |
steps: | |
- name: 'Checkout repo' | |
uses: 'actions/checkout@v5' | |
- name: 'Install dependencies' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y git curl jq | |
- name: 'Update lists' | |
run: | | |
sh ./update.sh | |
- name: 'Merge, filter, and release' | |
run: | | |
sh ./merge_and_release.sh | |
- name: 'Push lists' | |
if: >- | |
github.event_name == 'schedule' || | |
github.event_name == 'workflow_dispatch' | |
run: | | |
git config --global --add safe.directory "${PWD:?}" | |
git config --global user.name 'skiddle-bot' | |
git config --global user.email '[email protected]' | |
sh ./push.sh | |
- name: Notify via Discord (Success) | |
if: success() | |
run: | | |
TIME=$(date +"%Y-%m-%d %H:%M:%S") | |
curl -H "Content-Type: application/json" \ | |
-X POST -d "$(jq -n --arg repo "${{ github.repository }}" \ | |
--arg workflow "${{ github.workflow }}" \ | |
--arg event "${{ github.event_name }}" \ | |
--arg time "$TIME" \ | |
'{ | |
"embeds": [{ | |
"title": "✅ Update Job Successful", | |
"description": "The update job has completed and pushed successfully.", | |
"color": 2123412, | |
"fields": [ | |
{"name": "Repository", "value": $repo, "inline": true}, | |
{"name": "Event", "value": $event, "inline": true}, | |
{"name": "Workflow", "value": $workflow, "inline": true}, | |
{"name": "Time", "value": $time} | |
], | |
"footer": {"text": "Skiddle Bot | GitHub Actions"} | |
}] | |
}')" ${{ secrets.DISCORD_WEBHOOK }} | |
shell: bash | |
- name: Notify via Discord (Failure) | |
if: failure() | |
run: | | |
TIME=$(date +"%Y-%m-%d %H:%M:%S") | |
curl -H "Content-Type: application/json" \ | |
-X POST -d "$(jq -n --arg repo "${{ github.repository }}" \ | |
--arg workflow "${{ github.workflow }}" \ | |
--arg event "${{ github.event_name }}" \ | |
--arg time "$TIME" \ | |
'{ | |
"embeds": [{ | |
"title": "❌ Update Job Failed", | |
"description": "An error occurred during the update job.", | |
"color": 15158332, | |
"fields": [ | |
{"name": "Repository", "value": $repo, "inline": true}, | |
{"name": "Event", "value": $event, "inline": true}, | |
{"name": "Workflow", "value": $workflow, "inline": true}, | |
{"name": "Time", "value": $time} | |
], | |
"footer": {"text": "Skiddle Bot | GitHub Actions"} | |
}] | |
}')" ${{ secrets.DISCORD_WEBHOOK }} | |
shell: bash |