# The docs.github.com project has two repositories: github/docs (public) and github/docs-internal (private) # # This GitHub Actions workflow keeps the main branch of those two repos in sync. # # For more details, see https://github.com/repo-sync/repo-sync#how-it-works name: Repo Sync on: schedule: - cron: "*/15 * * * *" # every 15 minutes env: FREEZE: ${{ secrets.FREEZE }} jobs: check-freezer: name: Check for deployment freezes runs-on: ubuntu-latest steps: - name: Exit if repo is frozen if: ${{ env.FREEZE == 'true' }} run: | echo 'The repo is currently frozen! Exiting this workflow.' exit 1 # prevents further steps from running repo-sync: name: Repo Sync needs: check-freezer runs-on: ubuntu-latest steps: - name: Check out repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f - name: Sync repo to branch uses: repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88 env: GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} with: source_repo: ${{ secrets.SOURCE_REPO }} # https://${access_token}@github.com/github/the-other-repo.git source_branch: main destination_branch: repo-sync github_token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} - name: Create pull request uses: repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d env: GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} with: source_branch: repo-sync destination_branch: main pr_title: "repo sync" 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!" pr_label: automerge,autoupdate github_token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} - name: Find pull request uses: juliangruber/find-pull-request-action@64d55773c959748ad30a4184f4dc102af1669f7b id: find-pull-request with: github-token: ${{ secrets.GITHUB_TOKEN }} branch: repo-sync base: main - name: Approve pull request if: ${{ steps.find-pull-request.outputs.number }} uses: juliangruber/approve-pull-request-action@c530832d4d346c597332e20e03605aa94fa150a8 with: github-token: ${{ secrets.GITHUB_TOKEN }} number: ${{ steps.find-pull-request.outputs.number }} - name: Send Slack notification if workflow fails uses: rtCamp/action-slack-notify@e17352feaf9aee300bf0ebc1dfbf467d80438815 if: ${{ failure() }} env: SLACK_WEBHOOK: ${{ secrets.DOCS_ALERTS_SLACK_WEBHOOK }} SLACK_USERNAME: docs-repo-sync SLACK_ICON_EMOJI: ':ohno:' SLACK_COLOR: '#B90E0A' # Crimson SLACK_MESSAGE: The last repo-sync run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions?query=workflow%3A%22Repo+Sync%22