Skip to content

Commit

Permalink
add logic for if dest branch doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Oct 24, 2024
1 parent f1065ac commit 2616fdb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/copy-content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,29 @@ jobs:
uses: actions/checkout@v4
with:
path: "source"
- name: Checkout destination repo

- name: Checkout destination repo (Branch exists)
uses: actions/checkout@v4
if: ${{ steps.check_branch.outputs.branch_exists != 0 }}
with:
path: "destination"
repository: ${{ inputs.repo }}
token: ${{ secrets.PAT }}
ref: ${{ inputs.branch }}

- name: Checkout destination repo (Branch doesn't exist)
uses: actions/checkout@v4
if: ${{ steps.check_branch.outputs.branch_exists == 0 }}
with:
path: "destination"
repository: ${{ inputs.repo }}
token: ${{ secrets.PAT }}
- name: Create branch in destination repo
if: ${{ steps.check_branch.outputs.branch_exists == 0 }}
run: |
cd destination
git checkout -b ${{ inputs.branch }}
- run: echo ${{inputs.prerun}}
- name: Run pre-run command
if: inputs.prerun != ''
Expand Down

0 comments on commit 2616fdb

Please sign in to comment.