Skip to content

Commit

Permalink
Merge pull request brain-bican#97 from puja-trivedi/push_to_bkbit_wor…
Browse files Browse the repository at this point in the history
…kflow_20241202

combining separate push_to_bkbit workflows
  • Loading branch information
djarecka authored Dec 3, 2024
2 parents b497979 + 9b04ac5 commit eb2163d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 71 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/push_anatomical_structure_to_bkbit.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/push_genome_annotation_to_bkbit.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: push pydantic models to bkbit
name: push pydantic models to brain-bican/bkbit

on:
push:
branches:
- main
# paths:
# - 'models_py-autogen/**'
paths:
- 'models_py-autogen/**'
workflow_run:
workflows: [generating other formats]
types:
- completed

jobs:
# ------------------------------------------------------------------------------------------------------------------------------------------------
# Event `pull_request`: Compare the last commit of the main branch or last remote commit of the PR branch -> to the current commit of a PR branch.
# ------------------------------------------------------------------------------------------------------------------------------------------------

changed_files:
runs-on: ubuntu-latest # windows-latest || macos-latest
runs-on: ubuntu-latest
name: Test changed-files
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -45,24 +46,36 @@ jobs:
cp $FILE bkbit/bkbit/models/$FILENAME
done
cd bkbit
git checkout -b new_version_of_model
ls -l bkbit/models
# Generate a unique branch name
TIMESTAMP=$(date +%Y%m%d%H%M%S)
BRANCH_NAME="update_models_${TIMESTAMP}"
echo "Generated branch name: $BRANCH_NAME"
git checkout -b $BRANCH_NAME
git branch
git add bkbit/models/*
git commit -m "Updated model(s), ${ALL_CHANGED_FILES}, are being copied and pushed from brain-bican/models repository."
git commit -m "The listed model(s) have been modified in the brain-bican/models repo: ${ALL_CHANGED_FILES}. New version of model(s) in pydantic format are being pushed from brain-bican/models to brain-bican/bkbit."
cd ..
# Set branch name as output
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_ENV
- name: Push changes to bkbit
env:
TARGET_REPO: brain-bican/bkbit
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
cd bkbit
git push origin new_version_of_model
git push origin ${{ env.branch_name }}
- name: Create pull request to bkbit
env:
TARGET_REPO: brain-bican/bkbit
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
run: |
curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-d '{"title":"Automated PR: Add new version of the library_generation model.", "head":"update_library_generation_model", "base":"main"}' \
-d "{\"title\":\"Automated PR from brain-bican/models: adding new version of pydantic model(s)\", \"body\":\"This PR includes changes to the following models:\\n\\n${ALL_CHANGED_FILES}\", \"head\":\"${{ env.branch_name }}\", \"base\":\"main\"}" \
https://api.github.com/repos/$TARGET_REPO/pulls

0 comments on commit eb2163d

Please sign in to comment.