Repository navigation
74 lines (63 loc) · 3.02 KB
/
Copy pathsync-copilot-standards.yml
File metadata and controls
74 lines (63 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Sync PowerShell standards
# Keeps this repository's PowerShell standards files in step with the standards
# repository, and opens a pull request when they change.
#
# Before the first run, enable:
# Settings -> Actions -> General -> Workflow permissions
# -> "Allow GitHub Actions to create and approve pull requests"
# Without it the job installs the files and then fails at the pull request step.
#
# Edit the three values under env to suit this repository.
on:
schedule:
- cron: '0 6 * * 1'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
# Repository that publishes the standards. Change it if you maintain a fork.
STANDARDS_REPO: fadwen/ai-powershell-standards
# Branch, tag, or commit to install from. Set a release tag to decide when updates arrive.
STANDARDS_REF: main
# Agents this repository uses: any of Copilot, ClaudeCode, Codex, separated by commas.
STANDARDS_AGENTS: Copilot,ClaudeCode,Codex
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Check out this repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check out the standards repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ env.STANDARDS_REPO }}
ref: ${{ env.STANDARDS_REF }}
path: .standards
persist-credentials: false
- name: Install the standards
id: install
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$agents = @($env:STANDARDS_AGENTS -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ })
$files = @(./.standards/Tools/Install-CopilotStandards.ps1 -ProjectPath . -Agent $agents -RemoveLegacyFiles)
$files | Where-Object Status -NE 'Unchanged' | Format-Table -Property Status, Path -AutoSize
$manifest = Import-PowerShellDataFile -LiteralPath ./.standards/standards/manifest.psd1
"version=$($manifest.Version)" >> $env:GITHUB_OUTPUT
Remove-Item -LiteralPath ./.standards -Recurse -Force
- name: Open pull request
uses: peter-evans/create-pull-request@3ffccacd46053766916f087ce41d627c0b8cf2d1 # v8.1.3
with:
branch: chore/sync-powershell-standards
delete-branch: true
commit-message: 'chore: sync PowerShell standards ${{ steps.install.outputs.version }}'
title: 'chore: sync PowerShell standards ${{ steps.install.outputs.version }}'
body: |
Automated update from `${{ env.STANDARDS_REPO }}` at `${{ env.STANDARDS_REF }}`,
standards version ${{ steps.install.outputs.version }}.
The files in this pull request are generated. Do not edit them here: a change made in
this repository is overwritten by the next run. Propose it in the standards repository
instead.
This repository's own `AGENTS.md` and `.github/copilot-instructions.md`
are replaced only if an earlier installation wrote them.