This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 489
51 lines (41 loc) · 1.76 KB
/
create-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Create PR
on:
pull_request:
types: [opened]
jobs:
gitIssueCreation:
name: Create Issue
runs-on: ubuntu-latest
steps:
- name: Dump context
uses: crazy-max/ghaction-dump-context@v1
- uses: actions/checkout@v2
name: Checkout Repo
with:
submodules: true
- name: Install GH Cli
run: |
brew install gh
- name: Clone Private repo
run: |
git clone "https://${{ secrets.PRIVATE_REPO_PAT }}@github.com/microsoft/azuretipsandtricks-private.git" private
cd private
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git fetch
git pull
git checkout -b "public-pr-${{ github.event.number }}"
git push -u origin "public-pr-${{ github.event.number }}"
cp -r "${{ github.workspace }}/blog" "${{ github.workspace }}/private/src/blog"
cp -r "${{ github.workspace }}/.vuepress/public/files" "${{ github.workspace }}/private/src/.vuepress/public/files"
git add .
git commit -m "${{ github.event.pull_request.title }}"
git push
- name: GH CLI
run: |
cd "${{ github.workspace }}/private"
git checkout "public-pr-${{ github.event.number }}"
COMMIT_MESSAGE="**Pull Request Created in public repo** <br /><br /> **Title:** ${{ github.event.pull_request.title }} <br /><br /> **Link:** https://github.com/microsoft/AzureTipsAndTricks/pull/${{ github.event.number }}"
gh pr create --title "Public Repo PR" --body "$COMMIT_MESSAGE" -R microsoft/azuretipsandtricks-private
env:
GITHUB_TOKEN: ${{ secrets.PRIVATE_REPO_PAT }}