Skip to content

Commit

Permalink
Simplify automated PR workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
karlaspuldaro committed Nov 20, 2023
1 parent d476445 commit d06ab9e
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/run_experiments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,45 @@ jobs:
METRIQ_TOKEN: ${{ secrets.METRIQ_TOKEN}}

steps:
- name: Setup repository on this workflow
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install and configure Github CLI
uses: cli/cli/[email protected]
with:
gh-version: 2


- name: Install tox
run: pip install tox
run: pip install tox

- name: Run experiment steps in tox
run: tox -ve py38

handle_new_artifacts:
runs on: ubuntu-latest
needs: run_experiment_steps

- name: Configure Git with Bot Git Config
run: |
git config user.name "${{ secrets.BOT_USERNAME }}"
git config user.email "${{ secrets.BOT_EMAIL }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check for updates on result files and open new PR with Bot user
run: |
untracked_csv_files=$(find ./benchmarking/results/ -name '*.csv' -type f)
- name: Check for new artifacts and open new PR with Bot user
run: |
new_csv_files=$(find ./benchmarking/results/ -name '*.csv' -type f)
deleted_csv_files=$(git diff --name-only HEAD@{1} HEAD | grep -E '^../results/.*\.csv')
if [ -n "$untracked_csv_files" ] || [ -n "deleted_csv_files"]; then
if [ -n "$new_csv_files" ] || [ -n "deleted_csv_files"]; then
git checkout -b bot-branch
git add $untracked_csv_files
git add $new_csv_files
git rm $deleted_csv_files
git commit -m "Add new result files"
git push --set-upstream origin bot-branch
gh pr create --base main --head bot-branch --title "Add new result files"
git checkout main
uses: pullreminders/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: bot-branch
title: "Add new result files"
else
echo "No generated artifacts"
fi
env:
BOT_USERNAME: ${{ secrets.BOT_USERNAME }}
BOT_EMAIL: ${{ secrets.BOT_EMAIL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}


0 comments on commit d06ab9e

Please sign in to comment.