name: sync-fork on: schedule: - cron: '0 0 * * *' workflow_dispatch: jobs: sync: # Only set the topic `has-issrc-build-env-sync-token` if the secret is available if: contains(github.event.repository.topics, 'has-issrc-build-env-sync-token') runs-on: ubuntu-latest permissions: contents: write steps: - name: Synchronize fork run: gh repo sync $REPOSITORY -b $BRANCH_NAME env: GITHUB_TOKEN: ${{ secrets.ISSRC_BUILD_ENV_SYNC_TOKEN }} REPOSITORY: ${{ github.repository }} BRANCH_NAME: ${{ github.ref_name }} - name: Copilot review request run: | PR_NUMBER=$(gh pr list --repo "$REPOSITORY" --state open --base "$PR_BASE" --head "$BRANCH_NAME" --json number --jq '.[0].number') if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then gh api --method POST /repos/$REPOSITORY/pulls/$PR_NUMBER/requested_reviewers -f "reviewers[]=copilot-pull-request-reviewer[bot]" fi env: GITHUB_TOKEN: ${{ secrets.ISSRC_BUILD_ENV_SYNC_TOKEN }} REPOSITORY: ${{ github.repository }} BRANCH_NAME: ${{ github.ref_name }} PR_BASE: copilot-review