Skip to content

Commit 2f881dc

Browse files
authored
Merge pull request #88 from DaveGreen-Games/controllerdb-update-workflow
Add controller db update automation workflow file
2 parents f37afbb + 6f7ffc0 commit 2f881dc

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow automatically updates ShapeEngine/gamecontrollerdb.txt monthly.
2+
# Steps:
3+
# 1. Downloads the latest gamecontrollerdb.txt from SDL_GameControllerDB.
4+
# 2. Stages the file and checks for changes.
5+
# 3. If changes are detected:
6+
# - Creates a new branch
7+
# - Commits the update
8+
# - Pushes the branch
9+
# - Opens a pull request
10+
# 4. If no changes, no branch/commit/PR is created.
11+
# The workflow is triggered monthly and can be run manually.
12+
13+
name: Monthly Update gamecontrollerdb.txt
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
on:
20+
schedule:
21+
- cron: '0 0 1 * *' # Runs at midnight on the 1st of every month
22+
workflow_dispatch: # Manual trigger
23+
24+
jobs:
25+
update-controllerdb:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout repo
29+
uses: actions/checkout@v4
30+
31+
- name: Download latest gamecontrollerdb.txt
32+
run: |
33+
curl -sSL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o ShapeEngine/gamecontrollerdb.txt
34+
35+
- name: Set up git user
36+
run: |
37+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
38+
git config --local user.name "github-actions[bot]"
39+
40+
- name: Stage gamecontrollerdb.txt
41+
run: |
42+
git add ShapeEngine/gamecontrollerdb.txt
43+
44+
- name: Create Pull Request
45+
uses: peter-evans/create-pull-request@v5
46+
with:
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
commit-message: "Automated monthly update of gamecontrollerdb.txt"
49+
branch: update-controllerdb-${{ github.run_id }}
50+
title: "Automated monthly update of gamecontrollerdb.txt"
51+
body: |
52+
This PR updates `ShapeEngine/gamecontrollerdb.txt` from [SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) as part of the scheduled monthly update.
53+
skip-if-no-changes: true

0 commit comments

Comments
 (0)