|
| 1 | +# Example: Using PR Templates from Target Repository |
| 2 | +# This configuration demonstrates the hybrid PR template approach |
| 3 | + |
| 4 | +source_repo: "myorg/source-repo" |
| 5 | +source_branch: "main" |
| 6 | + |
| 7 | +copy_rules: |
| 8 | + # Example 1: Use target repo's PR template with appended copier info |
| 9 | + - name: "use-target-template-with-append" |
| 10 | + source_pattern: |
| 11 | + type: "prefix" |
| 12 | + pattern: "examples/" |
| 13 | + targets: |
| 14 | + - repo: "myorg/target-repo" |
| 15 | + branch: "main" |
| 16 | + path_transform: "code-examples/${relative_path}" |
| 17 | + commit_strategy: |
| 18 | + type: "pull_request" |
| 19 | + pr_title: "Update code examples from ${source_repo}" |
| 20 | + |
| 21 | + # Fetch and use the PR template from the target repository |
| 22 | + use_target_pr_template: true |
| 23 | + |
| 24 | + # Optional: Specify custom template path (defaults to .github/pull_request_template.md) |
| 25 | + pr_template_path: ".github/pull_request_template.md" |
| 26 | + |
| 27 | + # Append copier-specific information after the template |
| 28 | + pr_body_append: | |
| 29 | + |
| 30 | + --- |
| 31 | + ## 🤖 Automated Copy Information |
| 32 | + |
| 33 | + This PR was automatically created by the examples-copier service. |
| 34 | + |
| 35 | + - **Source Repository**: ${source_repo} |
| 36 | + - **Source Branch**: ${source_branch} |
| 37 | + - **Source PR**: #${pr_number} |
| 38 | + - **Source Commit**: ${commit_sha} |
| 39 | + - **Files Updated**: ${file_count} |
| 40 | + - **Copy Rule**: ${rule_name} |
| 41 | + |
| 42 | + ### Review Checklist |
| 43 | + - [ ] Verify all files copied correctly |
| 44 | + - [ ] Check for any breaking changes |
| 45 | + - [ ] Run tests locally |
| 46 | + |
| 47 | + auto_merge: false |
| 48 | + |
| 49 | + # Example 2: Use target repo's PR template without appending |
| 50 | + - name: "use-target-template-only" |
| 51 | + source_pattern: |
| 52 | + type: "prefix" |
| 53 | + pattern: "docs/" |
| 54 | + targets: |
| 55 | + - repo: "myorg/target-repo" |
| 56 | + branch: "main" |
| 57 | + path_transform: "documentation/${relative_path}" |
| 58 | + commit_strategy: |
| 59 | + type: "pull_request" |
| 60 | + pr_title: "Update documentation from ${source_repo}" |
| 61 | + |
| 62 | + # Just use the target repo's template as-is |
| 63 | + use_target_pr_template: true |
| 64 | + |
| 65 | + auto_merge: false |
| 66 | + |
| 67 | + # Example 3: Traditional approach - define PR body in config |
| 68 | + - name: "define-pr-body-in-config" |
| 69 | + source_pattern: |
| 70 | + type: "prefix" |
| 71 | + pattern: "scripts/" |
| 72 | + targets: |
| 73 | + - repo: "myorg/target-repo" |
| 74 | + branch: "main" |
| 75 | + path_transform: "scripts/${relative_path}" |
| 76 | + commit_strategy: |
| 77 | + type: "pull_request" |
| 78 | + pr_title: "Update scripts from ${source_repo}" |
| 79 | + |
| 80 | + # Define the entire PR body in the config |
| 81 | + pr_body: | |
| 82 | + ## Automated Update |
| 83 | + |
| 84 | + This PR updates scripts from the source repository. |
| 85 | + |
| 86 | + ### Details |
| 87 | + - **Source**: ${source_repo} |
| 88 | + - **PR**: #${pr_number} |
| 89 | + - **Commit**: ${commit_sha} |
| 90 | + - **Files**: ${file_count} |
| 91 | + |
| 92 | + ### Testing |
| 93 | + Please verify that all scripts work as expected. |
| 94 | + |
| 95 | + auto_merge: false |
| 96 | + |
| 97 | + # Example 4: Fallback behavior - template not found |
| 98 | + - name: "template-with-fallback" |
| 99 | + source_pattern: |
| 100 | + type: "prefix" |
| 101 | + pattern: "config/" |
| 102 | + targets: |
| 103 | + - repo: "myorg/target-repo" |
| 104 | + branch: "main" |
| 105 | + path_transform: "config/${relative_path}" |
| 106 | + commit_strategy: |
| 107 | + type: "pull_request" |
| 108 | + pr_title: "Update config from ${source_repo}" |
| 109 | + |
| 110 | + # Try to use target template, but provide fallback via pr_body |
| 111 | + use_target_pr_template: true |
| 112 | + pr_template_path: ".github/pull_request_template.md" |
| 113 | + |
| 114 | + # This will be used if the template file is not found |
| 115 | + pr_body: | |
| 116 | + ## Configuration Update |
| 117 | + |
| 118 | + Automated update of configuration files. |
| 119 | + |
| 120 | + - Source: ${source_repo} |
| 121 | + - Files: ${file_count} |
| 122 | + |
| 123 | + # This will be appended if the template IS found |
| 124 | + pr_body_append: | |
| 125 | + |
| 126 | + --- |
| 127 | + **Automated by**: examples-copier |
| 128 | + |
| 129 | + auto_merge: false |
| 130 | + |
0 commit comments