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