-
Notifications
You must be signed in to change notification settings - Fork 62
98 lines (85 loc) · 2.76 KB
/
Awesome-Game-Analysis.yml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Awesome-Game-Analysis
on:
push:
branches:
- main
- test
paths:
- 'data/preface.md'
- 'data/games.toml'
- 'data/references.md'
- 'data/epilogue.md'
- 'scripts/toml_markdown.py'
- 'scripts/generate_contributors.py'
- '.github/workflows/Awesome-Game-Analysis.yml'
pull_request:
branches:
- main
jobs:
pr_job:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11.4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: Execute Python scripts
id: execute-scripts
run: |
python scripts/toml_markdown.py -i data/games.toml -t toml --readme
push_job:
runs-on: ubuntu-latest
permissions:
contents: write
if: github.event_name == 'push'
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.MY_PAT }}
- name: Set up Git User
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11.4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: Execute Python scripts
id: execute-scripts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python scripts/toml_markdown.py -i data/games.toml -t toml --readme
python scripts/generate_contributors.py
- name: Get commit message
id: get-commit-message
run: |
echo "Setting commit message."
COMMIT_MSG="Update Readme"
echo "::set-output name=commit-message::$COMMIT_MSG"
- name: Commit changes
run: |
if [ "${{ steps.execute-scripts.outcome }}" == "success" ]; then
commit_message="${{ steps.get-commit-message.outputs.commit-message }}"
git add .
git commit --allow-empty -m "$commit_message"
git push --force -u origin main
else
echo "Execution failed. Exiting."
exit 1
fi