Skip to content

update (#94)

update (#94) #234

# 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