Update database #2547
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 database | |
on: | |
schedule: | |
- cron: "0 */12 * * *" | |
workflow_dispatch: | |
inputs: | |
skipUpdate: | |
description: Skip update | |
required: false | |
type: boolean | |
manualDownload: | |
description: Manually enter publishedfileids to download (separated by [^\d]+) | |
required: false | |
type: string | |
downloadSince: | |
description: Download items that have been updated after this unix timestamp | |
required: false | |
type: string | |
jobs: | |
update_database: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run mod-scraper | |
run: docker compose up | |
env: | |
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} | |
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} | |
STEAM_API_KEY: ${{ secrets.STEAM_API_KEY }} | |
SKIP_UPDATE: ${{ inputs.skipUpdate }} | |
MANUAL_DOWNLOAD: ${{ inputs.manualDownload }} | |
DOWNLOAD_SINCE: ${{ inputs.downloadSince }} | |
- id: extract | |
name: Extract the updated databases and changelog | |
run: | | |
docker compose cp mod-scraper:/home/steam/app/mod/Scripts/data/ ./mod/Scripts/ | |
docker compose cp mod-scraper:/home/steam/app/changelog.json ./changelog.json | |
changelog=`cat ./changelog.json` | |
echo "::set-output name=changelog::$changelog" | |
- name: Commit updated databases | |
if: ${{ fromJson(steps.extract.outputs.changelog).changeCount > 0 }} | |
env: | |
COMMIT_MESSAGE: ${{ fromJson(steps.extract.outputs.changelog).messageMD }} | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "Update databases" -m "$COMMIT_MESSAGE" | |
git push |