Skip to content

[update] Readme

[update] Readme #2

Workflow file for this run

name: CI/CD - Combine JSON Files
on:
push:
branches:
- main # Trigger on push to main branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
# Pull latest changes from the remote main branch to avoid conflicts
- name: Pull latest changes from remote
run: |
git fetch origin
git merge origin/main --strategy=recursive --strategy-option=theirs
- name: List files in data directory
run: ls -al data/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Run combine_json.py
run: python scripts/combine_json.py
- name: Check if data.json exists
run: |
if [ -f data/data.json ]; then
echo "data/data.json exists"
else
echo "data/data.json does not exist"
exit 1
fi
- name: Commit combined data.json
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add data/data.json
git commit -m "Update combined data.json"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git push
# Notify Discord that the process is complete
- name: Send Discord Notification
run: |
curl -X POST ${{ secrets.DISCORD_WEBHOOK_URL }} \
-H "Content-Type: application/json" \
-d '{
"embeds": [{
"title": "GitHub Actions Workflow Complete",
"description": "The **combine_json.py** script has finished successfully!",
"color": 3066993,
"fields": [
{
"name": "Repository",
"value": "'${{ github.repository }}'",
"inline": true
},
{
"name": "Branch",
"value": "main",
"inline": true
},
{
"name": "Status",
"value": "Success",
"inline": false
}
],
"footer": {
"text": "GitHub Actions",
"icon_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
},
"timestamp": "'$(date --utc +%FT%TZ)'"
}]
}'