Skip to content

Commit

Permalink
Update create-token-pr.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
alizedebray committed Oct 16, 2024
1 parent 81f3e39 commit 46ab176
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/create-token-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# Get the name of the token branch which was pushed and the corresponding PR branch
# Get the name of the PR branch corresponding to the token branch
- name: Get Branch Name
id: branch-names
run: |
echo "pr-branch=merge-tokens-$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT
# Check if the PR branch already exists
- name: Check PR Branch
id: git-branch
id: ls-remote
run: |
GIT_BRANCH="$(git branch -l $PR_BRANCH)"
echo "pr_branch=${GIT_BRANCH}" >> $GITHUB_OUTPUT
echo "pr_branch=$(git ls-remote origin $PR_BRANCH)" >> $GITHUB_OUTPUT
env:
PR_BRANCH: ${{ steps.branch-names.outputs.pr-branch }}

# if the branch already exits, update the PR
- name: Update Branch
if: steps.git-branch.outputs.pr_branch != ''
if: steps.ls-remote.outputs.pr_branch != ''
run: |
git checkout $PR_BRANCH
git merge ${{ github.ref_name }} -X theirs --no-edit
Expand All @@ -47,7 +46,7 @@ jobs:

# if the branch does not exit, create the PR
- name: Create PR
if: steps.git-branch.outputs.pr_branch == ''
if: steps.ls-remote.outputs.pr_branch == ''
run: |
git checkout -b $PR_BRANCH ${{ github.ref_name }}
git push --set-upstream origin merge-tokens-v2-24-10
Expand Down

0 comments on commit 46ab176

Please sign in to comment.