From 4c22de79410118f3daac9fc3405ccc7702b3bee2 Mon Sep 17 00:00:00 2001 From: Vince Rose Date: Tue, 1 Aug 2023 22:09:44 -0700 Subject: [PATCH] fixes to chery-pick workflow --- .github/workflows/cherry-pick-main.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cherry-pick-main.yml b/.github/workflows/cherry-pick-main.yml index 3a135c73a..cd428c8de 100644 --- a/.github/workflows/cherry-pick-main.yml +++ b/.github/workflows/cherry-pick-main.yml @@ -49,23 +49,31 @@ jobs: run: | git config user.name "GitHub Actions" git config user.email noreply@github.com + - name: Set commitHash workflow input + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV + - name: Set commitHash pull request input + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "COMMIT_HASH=$(git rev-parse ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV - name: Create cherry-pick branch run: | - git checkout -b cherry-pick-${{ github.event.inputs.commitHash }} + git checkout -b cherry-pick-${{ env.COMMIT_HASH }} - name: Cherry-pick commit run: | - git cherry-pick ${{ github.event.inputs.commitHash }} + git cherry-pick ${{ env.COMMIT_HASH }} - name: Push new branch - run: git push origin cherry-pick-${{ github.event.inputs.commitHash }} + run: git push origin cherry-pick-${{ env.COMMIT_HASH }} - name: Create pull request into private-main - uses: thomaseizinger/create-pull-request@1.0.0 + uses: thomaseizinger/create-pull-request@1.3.1 with: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} title: Cherry-pick ${{ github.event.inputs.commitHash }} to private-main body: | This pull request was automatically created by a GitHub Action. - The commit ${{ github.event.inputs.commitHash }} was cherry-picked from the main branch. + The commit ${{ env.COMMIT_HASH }} was cherry-picked from the main branch. Merge the pull request. **DO NOT SQUASH** - head: cherry-pick-${{ github.event.inputs.commitHash }} + head: cherry-pick-${{ env.COMMIT_HASH }} base: private-main repository: BC-Security/Empire-Sponsors