|
| 1 | +name: Sync Copilot Instructions |
| 2 | +description: "Syncs Copilot instructions from the repository to the GitHub Action's metadata file." |
| 3 | +inputs: |
| 4 | + common_workflows_ref: |
| 5 | + description: "The ref to sync from the central repository" |
| 6 | + required: false |
| 7 | + default: "main" |
| 8 | + type: string |
| 9 | + calling_repo_base_branch: |
| 10 | + description: "The base branch from the calling repository that should be merged into" |
| 11 | + required: false |
| 12 | + type: string |
| 13 | + default: main |
| 14 | +runs: |
| 15 | + using: "composite" |
| 16 | + steps: |
| 17 | + - name: Checkout calling repo code |
| 18 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 19 | + with: |
| 20 | + ref: ${{ inputs.calling_repo_base_branch }} |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Checkout central repo code |
| 24 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 25 | + with: |
| 26 | + ref: ${{ inputs.common_workflows_ref }} |
| 27 | + fetch-depth: 0 |
| 28 | + path: eps-common-workflows |
| 29 | + repository: NHSDigital/eps-common-workflows |
| 30 | + sparse-checkout: | |
| 31 | + .github/instructions/general |
| 32 | + .github/instructions/languages |
| 33 | + .github/copilot-instructions.md |
| 34 | + .github/prompts |
| 35 | +
|
| 36 | + - name: Copy central instructions |
| 37 | + run: | |
| 38 | + rm -rf .github/instructions/general |
| 39 | + rm -rf .github/instructions/languages |
| 40 | + rm -rf .github/copilot-instructions.md |
| 41 | + rm -rf .github/prompts |
| 42 | + mkdir -p .github/instructions/ |
| 43 | + cp -R eps-common-workflows/.github/instructions/general .github/instructions/general |
| 44 | + cp -R eps-common-workflows/.github/instructions/languages .github/instructions/languages |
| 45 | + cp eps-common-workflows/.github/copilot-instructions.md .github/copilot-instructions.md |
| 46 | + cp -R eps-common-workflows/.github/prompts .github/prompts |
| 47 | + rm -rf eps-common-workflows |
| 48 | +
|
| 49 | + - name: Create GitHub App Token |
| 50 | + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 |
| 51 | + id: generate-token |
| 52 | + with: |
| 53 | + app-id: "${{ secrets.CREATE_PULL_REQUEST_APP_ID }}" |
| 54 | + private-key: "${{ secrets.CREATE_PULL_REQUEST_PEM }}" |
| 55 | + |
| 56 | + - name: Create Pull Request |
| 57 | + uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 |
| 58 | + with: |
| 59 | + token: "${{ steps.generate-token.outputs.token }}" |
| 60 | + commit-message: "Upgrade: [dependabot] - sync Copilot instructions" |
| 61 | + title: "Upgrade: [dependabot] - sync Copilot instructions" |
| 62 | + body: | |
| 63 | + Syncing Copilot instructions from central repo. |
| 64 | + Ref: `${{ inputs.common_workflows_ref }}` |
| 65 | + branch: copilot-instructions-sync |
| 66 | + base: ${{ inputs.calling_repo_base_branch }} |
| 67 | + branch-suffix: random |
| 68 | + sign-commits: true |
| 69 | + delete-branch: true |
0 commit comments