|
| 1 | +name: Repo Sync |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "*/30 * * * *" # every 30 minutes. |
| 6 | + |
| 7 | +jobs: |
| 8 | + repo-sync: |
| 9 | + name: Repo Sync |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + |
| 14 | + - uses: repo-sync/github-sync@v2 |
| 15 | + name: Sync repo to branch |
| 16 | + env: |
| 17 | + GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_REPO_SCOPE }} |
| 18 | + with: |
| 19 | + source_repo: ${{ secrets.SOURCE_REPO }} |
| 20 | + source_branch: master |
| 21 | + destination_branch: ${{ secrets.INTERMEDIATE_BRANCH }} |
| 22 | + github_token: ${{ secrets.DOCS_BOT_PAT_REPO_SCOPE }} |
| 23 | + |
| 24 | + - uses: repo-sync/pull-request@v2 |
| 25 | + name: Create pull request |
| 26 | + env: |
| 27 | + GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_REPO_SCOPE }} |
| 28 | + with: |
| 29 | + source_branch: ${{ secrets.INTERMEDIATE_BRANCH }} |
| 30 | + destination_branch: master |
| 31 | + pr_title: 'repo sync' |
| 32 | + pr_body: "This is an automated pull request to sync changes between the public and private repos.\n\n:robot: This pull request should be merged (not squashed) to preserve continuity across repos, so please let a bot do the merging!" |
| 33 | + pr_label: autoupdate,automated-reposync-pr |
| 34 | + github_token: ${{ secrets.DOCS_BOT_PAT_REPO_SCOPE }} |
| 35 | + |
| 36 | + - name: Find pull request |
| 37 | + uses: juliangruber/find-pull-request-action@v1 |
| 38 | + id: find-pull-request |
| 39 | + with: |
| 40 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + branch: repo-sync |
| 42 | + base: master |
| 43 | + author: bot-docsteam |
| 44 | + state: open |
| 45 | + |
| 46 | + - name: Approve pull request |
| 47 | + if: ${{ steps.find-pull-request.outputs.number }} |
| 48 | + uses: juliangruber/approve-pull-request-action@v1 |
| 49 | + with: |
| 50 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + number: ${{ steps.find-pull-request.outputs.number }} |
| 52 | + |
| 53 | + - name: Merge Pull Request |
| 54 | + if: ${{ steps.find-pull-request.outputs.number }} |
| 55 | + uses: juliangruber/merge-pull-request-action@v1 |
| 56 | + with: |
| 57 | + github-token: ${{ secrets.DOCS_BOT_PAT_REPO_SCOPE }} |
| 58 | + number: ${{ steps.find-pull-request.outputs.number }} |
| 59 | + method: merge |
0 commit comments