Skip to content

Commit eb2163d

Browse files
authored
Merge pull request #97 from puja-trivedi/push_to_bkbit_workflow_20241202
combining separate push_to_bkbit workflows
2 parents b497979 + 9b04ac5 commit eb2163d

File tree

3 files changed

+26
-71
lines changed

3 files changed

+26
-71
lines changed

.github/workflows/push_anatomical_structure_to_bkbit.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/push_genome_annotation_to_bkbit.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/push_librarygeneration_to_bkbit.yaml renamed to .github/workflows/push_pydantic_to_bkbit.yaml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
name: push pydantic models to bkbit
1+
name: push pydantic models to brain-bican/bkbit
22

33
on:
44
push:
55
branches:
66
- main
7-
# paths:
8-
# - 'models_py-autogen/**'
7+
paths:
8+
- 'models_py-autogen/**'
9+
workflow_run:
10+
workflows: [generating other formats]
11+
types:
12+
- completed
13+
914
jobs:
10-
# ------------------------------------------------------------------------------------------------------------------------------------------------
11-
# 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.
12-
# ------------------------------------------------------------------------------------------------------------------------------------------------
13-
1415
changed_files:
15-
runs-on: ubuntu-latest # windows-latest || macos-latest
16+
runs-on: ubuntu-latest
1617
name: Test changed-files
1718
steps:
1819
- uses: actions/checkout@v4
@@ -45,24 +46,36 @@ jobs:
4546
cp $FILE bkbit/bkbit/models/$FILENAME
4647
done
4748
cd bkbit
48-
git checkout -b new_version_of_model
49+
ls -l bkbit/models
50+
51+
# Generate a unique branch name
52+
TIMESTAMP=$(date +%Y%m%d%H%M%S)
53+
BRANCH_NAME="update_models_${TIMESTAMP}"
54+
echo "Generated branch name: $BRANCH_NAME"
55+
56+
git checkout -b $BRANCH_NAME
57+
git branch
4958
git add bkbit/models/*
50-
git commit -m "Updated model(s), ${ALL_CHANGED_FILES}, are being copied and pushed from brain-bican/models repository."
59+
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."
5160
cd ..
52-
61+
62+
# Set branch name as output
63+
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_ENV
64+
5365
- name: Push changes to bkbit
5466
env:
5567
TARGET_REPO: brain-bican/bkbit
5668
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
5769
run: |
5870
cd bkbit
59-
git push origin new_version_of_model
71+
git push origin ${{ env.branch_name }}
6072
6173
- name: Create pull request to bkbit
6274
env:
6375
TARGET_REPO: brain-bican/bkbit
6476
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
77+
ALL_CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
6578
run: |
6679
curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
67-
-d '{"title":"Automated PR: Add new version of the library_generation model.", "head":"update_library_generation_model", "base":"main"}' \
80+
-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\"}" \
6881
https://api.github.com/repos/$TARGET_REPO/pulls

0 commit comments

Comments
 (0)