Skip to content

Commit

Permalink
Create run_program.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamSwayne authored Nov 21, 2023
1 parent 6090041 commit 8646615
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/run_program.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Run python script

on: # run on commits to the main branch
push:
branches:
- main
workflow_dispatch: # run when triggered manually

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo content
uses: actions/checkout@v4 # checkout the repository content

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11' # install the python version needed

- name: Configure Git identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Execute python script first case
run: python build_template_from_source.py 3 4 10

- name: Execute python script second case
run: python build_template_from_source.py 5 2 3

- name: Execute python script third case
run: python build_template_from_source.py 1 10 10

- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "Changes found"
- name: Stage files
if: steps.git-check.outputs.return-code == '0'
run: git add .

- name: Commit changed files
if: steps.git-check.outputs.return-code == '0'
run: |
git commit -m "🤖 run python script" || echo "No changes to commit"
- name: Fetch from main
if: steps.git-check.outputs.return-code == '0'
run: git fetch origin main

- name: Push code to main
if: steps.git-check.outputs.return-code == '0'
run: git push origin HEAD:main

0 comments on commit 8646615

Please sign in to comment.