Skip to content

Commit

Permalink
dev: update sync workflow to run only when the source repo is configu…
Browse files Browse the repository at this point in the history
…red (#2346)

* dev: update sync workflow to run only when the source repo is configured

* fix: naming convention changes

---------

Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
  • Loading branch information
pablohashescobar and sriramveeraghanta authored Oct 3, 2023
1 parent 0d0cf30 commit d9bd078
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
58 changes: 34 additions & 24 deletions .github/workflows/create-sync-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@ jobs:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
pull-requests: write
contents: read
steps:
- name: Check SOURCE_REPO
id: check_repo
env:
SOURCE_REPO: ${{ secrets.SOURCE_REPO_NAME }}
run: |
echo "::set-output name=is_correct_repo::$(if [[ "$SOURCE_REPO" == "makeplane/plane" ]]; then echo 'true'; else echo 'false'; fi)"
- name: Checkout Code
if: steps.check_repo.outputs.is_correct_repo == 'true'
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Branch Name
if: steps.check_repo.outputs.is_correct_repo == 'true'
run: |
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV
echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV
- name: Setup GH CLI
if: steps.check_repo.outputs.is_correct_repo == 'true'
run: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
Expand All @@ -34,24 +44,24 @@ jobs:
sudo apt install gh -y
- name: Create Pull Request
if: steps.check_repo.outputs.is_correct_repo == 'true'
env:
GH_TOKEN: ${{ secrets.TOKEN }}
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
TARGET_REPO="makeplane/${{ secrets.REPO_NAME }}"
TARGET_BRANCH="${{ secrets.REPO_TARGET_BRANCH }}"
SOURCE_BRANCH="${{ env.BRANCH_NAME }}"
git checkout $SOURCE_BRANCH
git remote add target "https://$GH_TOKEN@github.com/$TARGET_REPO.git"
git push target $SOURCE_BRANCH:$SOURCE_BRANCH
PR_TITLE="${{ github.event.pull_request.title }}"
PR_BODY="${{ github.event.pull_request.body }}"
gh pr create \
--base $TARGET_BRANCH \
--head $SOURCE_BRANCH \
--title "$PR_TITLE" \
--body "$PR_BODY" \
--repo $TARGET_REPO
TARGET_REPO="${{ secrets.TARGET_REPO_NAME }}"
TARGET_BRANCH="${{ secrets.TARGET_REPO_BRANCH }}"
SOURCE_BRANCH="${{ env.SOURCE_BRANCH_NAME }}"
git checkout $SOURCE_BRANCH
git remote add target "https://$GH_TOKEN@github.com/$TARGET_REPO.git"
git push target $SOURCE_BRANCH:$SOURCE_BRANCH
PR_TITLE="${{ github.event.pull_request.title }}"
PR_BODY="${{ github.event.pull_request.body }}"
gh pr create \
--base $TARGET_BRANCH \
--head $SOURCE_BRANCH \
--title "$PR_TITLE" \
--body "$PR_BODY" \
--repo $TARGET_REPO
File renamed without changes.

1 comment on commit d9bd078

@vercel
Copy link

@vercel vercel bot commented on d9bd078 Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-sh-dev – ./space/

plane-sh-dev-plane.vercel.app
plane-space-dev.vercel.app
plane-sh-dev-git-develop-plane.vercel.app

Please # to comment.