mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
53 lines
2.1 KiB
YAML
53 lines
2.1 KiB
YAML
name: Create PR on Sync
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- "sync/**"
|
|
|
|
env:
|
|
CURRENT_BRANCH: ${{ github.ref_name }}
|
|
TARGET_BRANCH: "preview" # The target branch that you would like to merge changes like develop
|
|
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # Personal access token required to modify contents and workflows
|
|
ACCOUNT_USER_NAME: ${{ vars.ACCOUNT_USER_NAME }}
|
|
ACCOUNT_USER_EMAIL: ${{ vars.ACCOUNT_USER_EMAIL }}
|
|
|
|
jobs:
|
|
create_pull_request:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
contents: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Fetch all history for all branches and tags
|
|
|
|
- name: Setup Git
|
|
run: |
|
|
git config user.name "$ACCOUNT_USER_NAME"
|
|
git config user.email "$ACCOUNT_USER_EMAIL"
|
|
|
|
- name: Setup GH CLI and Git Config
|
|
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
|
|
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
|
sudo apt update
|
|
sudo apt install gh -y
|
|
|
|
- name: Create PR to Target Branch
|
|
run: |
|
|
# get all pull requests and check if there is already a PR
|
|
PR_EXISTS=$(gh pr list --base $TARGET_BRANCH --head $CURRENT_BRANCH --state open --json number | jq '.[] | .number')
|
|
if [ -n "$PR_EXISTS" ]; then
|
|
echo "Pull Request already exists: $PR_EXISTS"
|
|
else
|
|
echo "Creating new pull request"
|
|
PR_URL=$(gh pr create --base $TARGET_BRANCH --head $CURRENT_BRANCH --title "${{ vars.SYNC_PR_TITLE }}" --body "")
|
|
echo "Pull Request created: $PR_URL"
|
|
fi
|