From 3f6ffbc174811d4b62690169887c3c7b3a971d38 Mon Sep 17 00:00:00 2001 From: Jansen Kantor Date: Mon, 20 Oct 2025 22:31:48 -0400 Subject: [PATCH 1/3] feat: action for cherry-picking from openedx --- .github/workflows/cherry-pick-openedx.yml | 54 +++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/cherry-pick-openedx.yml diff --git a/.github/workflows/cherry-pick-openedx.yml b/.github/workflows/cherry-pick-openedx.yml new file mode 100644 index 0000000000..4e4b251efe --- /dev/null +++ b/.github/workflows/cherry-pick-openedx.yml @@ -0,0 +1,54 @@ +name: cherry-pick target commit from openedx repo into fork + +on: + workflow_dispatch: + inputs: + targetCommitHash: + description: 'Hash of the target commit to pull into the edX fork' + required: true + type: string + +jobs: + cherry-pick: + name: Cherry pick file + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: configure remotes + run: | + git remote add -f openedx git@github.com:openedx/frontend-app-learning.git + git remote rename origin edx + + - name: + run: git log -1 --remotes=openedx ${{ inputs.targetCommitHash }} + + - name: check that commit exists and load commit info + id: commit-info + run: | + PRETTY="" + PRETTY+="hash=%h%n" + PRETTY+="commit_subject=%s%n" + PRETTY+="author_name=%an%n" + PRETTY+="author_email=%ae%n" + PRETTY+="date=%ad%n" + + git log -1 --pretty=$PRETTY --remotes=openedx ${{ inputs.targetCommitHash }} >> $GITHUB_OUTPUT + + - name: Cherry pick target commit onto new branch + run: | + set -e + BRANCH_NAME="${{ github.actor }}/cherry-pick-${{ steps.commit-info.outputs.hash }}" + git checkout -b $BRANCH_NAME + git cherry-pick ${{ inputs.targetCommitHash }} + git commit -m "${{ steps.commit-info.outputs.commit_subject }}" + git push -u edx $BRANCH_NAME + + - name: Open pull request + run: | + BODY="" + BODY+="This PR cherry-picks commit ${{ steps.commit-info.outputs.hash }} from the openedx repo into the edx fork.\n\n" + BODY+="\tAuthor: ${{ steps.commit-info.outputs.author_name }} <${{ steps.commit-info.outputs.author_email }}>\n" + BODY+="\tDate: ${{ steps.commit-info.outputs.date }}\n" + gh pr create --title "${{ steps.commit-info.outputs.commit_subject }}" --body $BODY From 55cd90931c8f7a443790432a42aa7365a506af96 Mon Sep 17 00:00:00 2001 From: Jansen Kantor Date: Tue, 21 Oct 2025 14:55:06 -0400 Subject: [PATCH 2/3] fixup! feat: action for cherry-picking from openedx --- .github/workflows/cherry-pick-openedx.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cherry-pick-openedx.yml b/.github/workflows/cherry-pick-openedx.yml index 4e4b251efe..a34cbea844 100644 --- a/.github/workflows/cherry-pick-openedx.yml +++ b/.github/workflows/cherry-pick-openedx.yml @@ -18,12 +18,9 @@ jobs: - name: configure remotes run: | - git remote add -f openedx git@github.com:openedx/frontend-app-learning.git + git remote add -f openedx https://github.com/openedx/frontend-app-learning.git git remote rename origin edx - - name: - run: git log -1 --remotes=openedx ${{ inputs.targetCommitHash }} - - name: check that commit exists and load commit info id: commit-info run: | @@ -42,13 +39,17 @@ jobs: BRANCH_NAME="${{ github.actor }}/cherry-pick-${{ steps.commit-info.outputs.hash }}" git checkout -b $BRANCH_NAME git cherry-pick ${{ inputs.targetCommitHash }} - git commit -m "${{ steps.commit-info.outputs.commit_subject }}" git push -u edx $BRANCH_NAME - name: Open pull request + env: + GITHUB_TOKEN: ${{ github.GITHUB_TOKEN }} run: | - BODY="" - BODY+="This PR cherry-picks commit ${{ steps.commit-info.outputs.hash }} from the openedx repo into the edx fork.\n\n" - BODY+="\tAuthor: ${{ steps.commit-info.outputs.author_name }} <${{ steps.commit-info.outputs.author_email }}>\n" - BODY+="\tDate: ${{ steps.commit-info.outputs.date }}\n" - gh pr create --title "${{ steps.commit-info.outputs.commit_subject }}" --body $BODY + BODY=$(cat <<-EOF + This PR cherry-picks commit ${{ steps.commit-info.outputs.hash }} from the openedx repo into the edx fork. + + Author: ${{ steps.commit-info.outputs.author_name }} <${{ steps.commit-info.outputs.author_email }}> + Date: ${{ steps.commit-info.outputs.date }} + EOF + ) + gh pr create --title "${{ steps.commit-info.outputs.commit_subject }}" --body "$BODY" From e2991108cf181a58f5eafa5798976c8f2e3407bb Mon Sep 17 00:00:00 2001 From: Jansen Kantor Date: Wed, 22 Oct 2025 09:59:58 -0400 Subject: [PATCH 3/3] fix: private fork testing fixes --- .github/workflows/cherry-pick-openedx.yml | 32 ++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cherry-pick-openedx.yml b/.github/workflows/cherry-pick-openedx.yml index a34cbea844..f4b86bf01d 100644 --- a/.github/workflows/cherry-pick-openedx.yml +++ b/.github/workflows/cherry-pick-openedx.yml @@ -16,8 +16,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v5 - - name: configure remotes + - name: configure git run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" git remote add -f openedx https://github.com/openedx/frontend-app-learning.git git remote rename origin edx @@ -35,15 +37,25 @@ jobs: - name: Cherry pick target commit onto new branch run: | - set -e BRANCH_NAME="${{ github.actor }}/cherry-pick-${{ steps.commit-info.outputs.hash }}" git checkout -b $BRANCH_NAME - git cherry-pick ${{ inputs.targetCommitHash }} - git push -u edx $BRANCH_NAME + git cherry-pick ${{ inputs.targetCommitHash }} 2>&1 | tee cherry_pick_output + if [[ ${PIPESTATUS[0]} != 0 ]]; then + echo "## Unable to cherry-pick commit" >> $GITHUB_STEP_SUMMARY + cat cherry_pick_output >> $GITHUB_STEP_SUMMARY + exit 1 + fi + + git push -u edx $BRANCH_NAME 2>&1 | tee push_output + if [[ ${PIPESTATUS[0]} != 0 ]]; then + echo "## Unable to push to branch" >> $GITHUB_STEP_SUMMARY + cat push_output >> $GITHUB_STEP_SUMMARY + exit 1 + fi - name: Open pull request env: - GITHUB_TOKEN: ${{ github.GITHUB_TOKEN }} + GH_TOKEN: ${{ github.token }} run: | BODY=$(cat <<-EOF This PR cherry-picks commit ${{ steps.commit-info.outputs.hash }} from the openedx repo into the edx fork. @@ -52,4 +64,12 @@ jobs: Date: ${{ steps.commit-info.outputs.date }} EOF ) - gh pr create --title "${{ steps.commit-info.outputs.commit_subject }}" --body "$BODY" + gh pr create --title "${{ steps.commit-info.outputs.commit_subject }}" --body "$BODY" 1> pr_url 2> pr_errors + if [[ $? == 0 ]]; then + echo "## Pull Request Created! 🎉" >> $GITHUB_STEP_SUMMARY + echo $(cat pr_url) >> $GITHUB_STEP_SUMMARY + else + echo "## Pull request creation failed" >> $GITHUB_STEP_SUMMARY + echo $(cat pr_errors) >> $GITHUB_STEP_SUMMARY + exit 1 + fi