aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/update-museum.yml
blob: 282f387ecf6b624d2eea9d36719f6cfe23af21c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Update Museum Data

on:
  push:
    branches:
      - master

jobs:
  update-data:
    runs-on: ubuntu-latest

    if: ${{ github.repository_id == '247692460' }}

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: Install requests library
        run: python -m pip install requests

      - name: Run Python script
        run: python .github/scripts/updateMuseum.py

      - name: Commit and push changes
        run: |
          git config --global user.name "GitHub Actions"
          git config --global user.email "github-actions@github.com"
          git add constants/museum.json
          if git diff-index --quiet HEAD --; then
            echo "No changes to commit"
            exit 0
          fi
          git commit -m "Update museum data from Hypixel API"
          git push --force origin HEAD:bot/museum

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v7
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          branch: bot/museum
          base: master
          title: "Automated Update of Museum Data"
          body: "This pull request contains the latest museum data sourced from the Hypixel API."
          labels: "automated update"