Skip to content

Commit adf906f

Browse files
added steps to sync with upstream origin and delete updater branch once PR merged
1 parent 62ea11d commit adf906f

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

.github/workflows/odh-notebooks-sync.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
---
21
# The aim of this GitHub workflow is to update the pipfile to sync with Codeflare-SDK release.
32
name: Sync with codeflare-sdk release
4-
on: # yamllint disable-line rule:truthy
3+
on:
54
workflow_dispatch:
65
inputs:
6+
upstream-repository-organization:
7+
required: true
8+
description: "Provide the upstream repository organization name"
9+
710
codeflare-repository-organization:
811
required: true
912
description: "Provide the Codeflare repository organization name"
@@ -16,6 +19,7 @@ env:
1619
BRANCH_NAME: main
1720
CODEFLARE_RELEASE_VERSION: ${{ github.event.inputs.codeflare_sdk_release_version }}
1821
UPDATER_BRANCH: odh-sync-updater-${{ github.run_id }}
22+
UPSTREAM_OWNER: ${{ github.event.inputs.upstream-repository-organization }}
1923
REPO_OWNER: ${{ github.event.inputs.codeflare-repository-organization }}
2024
REPO_NAME: notebooks
2125
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
@@ -24,22 +28,20 @@ jobs:
2428
build:
2529
runs-on: ubuntu-latest
2630
steps:
27-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
2832
with:
2933
ref: ${{ env.BRANCH_NAME }}
3034

31-
- name: Clone repository
32-
id: Clone
35+
- name: Clone repository and Sync
3336
run: |
34-
git clone https://github.com/$REPO_OWNER/$REPO_NAME.git $REPO_NAME
37+
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/$REPO_OWNER/$REPO_NAME.git $REPO_NAME
3538
cd $REPO_NAME
36-
37-
- name: Set up Git
38-
run: |
39+
git remote add upstream https://github.com/$UPSTREAM_OWNER/$REPO_NAME.git
3940
git config --global user.email "[email protected]"
4041
git config --global user.name "codeflare-machine-account"
42+
git remote -v
43+
git pull upstream main && git push origin main
4144
42-
# Setup Python environment
4345
- name: Setup Python environment
4446
uses: actions/setup-python@v4
4547
with:
@@ -82,12 +84,12 @@ jobs:
8284
total=${#directories[@]}
8385
for dir in "${directories[@]}"; do
8486
counter=$((counter+1))
85-
echo -e "\n--Processing directory ($counter)'$dir' of total $total"
87+
echo "--Processing directory $counter '$dir' of total $total"
8688
cd "$dir" && pipenv install codeflare-sdk~="${CODEFLARE_RELEASE_VERSION}" && pipenv --rm && cd -
8789
echo "$((total-counter)) directories remaining.."
8890
done
8991
90-
- name: Push changes to forked repository
92+
- name: Push changes
9193
run: |
9294
cd $REPO_NAME
9395
git add . && git status && git checkout -b ${{ env.UPDATER_BRANCH }} && \
@@ -97,14 +99,12 @@ jobs:
9799
98100
- name: Create Pull Request
99101
run: |
100-
gh pr create --repo $REPO_OWNER/$REPO_NAME \
102+
gh pr create --repo $UPSTREAM_OWNER/$REPO_NAME \
101103
--title "$pr_title" \
102104
--body "$pr_body" \
103-
--label "$pr_label" \
104105
--head $REPO_OWNER:$UPDATER_BRANCH \
105106
--base $BRANCH_NAME
106107
env:
107-
pr_label: "automated pr"
108108
pr_title: "[Digest Updater Action] Update notebook's pipfile to sync with Codeflare-SDK release"
109109
pr_body: |
110110
:rocket: This is an automated Pull Request.

.github/workflows/project-codeflare-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ jobs:
157157
gh workflow run odh-notebooks-sync.yml \
158158
--repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator \
159159
--ref ${{ github.ref }} \
160+
--field upstream-repository-organization=opendatahub-io
160161
--field codeflare-repository-organization=${{ github.event.inputs.codeflare-repository-organization }} \
161162
--field codeflare_sdk_release_version=${{ github.event.inputs.codeflare-sdk-version }}
162163
env:

0 commit comments

Comments
 (0)