fix push ci (#11) #27
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
# 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 | |
paths: | |
- 'data/games.toml' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
pr_job: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- 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 | |
if: github.event_name == 'push' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- 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 | |
- name: Get commit message | |
id: get-commit-message | |
run: | | |
echo "Setting commit message." | |
COMMIT_MSG="Update from data/games.toml" | |
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 config --global user.name "K1ngst0m" | |
git config --global user.email "[email protected]" | |
git remote set-url origin https://${{ secrets.GITHUB_TOKEN }}@github.com/OTFCG/Awesome-Game-Analysis.git | |
git add . | |
git commit --allow-empty -m "$commit_message" | |
git push -u origin main | |
else | |
echo "Execution failed. Exiting." | |
exit 1 | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |