Skip to content

Parse and Update HTML #1433

Parse and Update HTML

Parse and Update HTML #1433

Workflow file for this run

name: Parse and Update HTML
on:
schedule:
- cron: '0 * * * *'
jobs:
parse_html_job:
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Fetch and update HTML
run: |
API_RESPONSE=$(curl -s https://api.lanyard.rest/v1/users/1159918868601503904 )
NEWDATA=$(echo "$API_RESPONSE" | jq -r '.data.activities[0].state')
echo "newData=$NEWDATA" >> $GITHUB_OUTPUT
if [ "$NEWDATA" = "null" ]; then
echo "No state found. Skipping file update."
exit 0
fi
sed -i -E "s@(<!--\\s*look\\s+here\\s+regex!!!\\s*-->)\\s*\"[^\"]*\"@\\1 \"$NEWDATA\"@g" index.html
- name: Commit and push
run: |
git config --global user.name 'github-actions'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add index.html
git commit -m "Automated status update"
git push