forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.95 KB
/
exp-json.yml
File metadata and controls
85 lines (71 loc) · 2.95 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
75
76
77
78
79
80
81
82
83
84
85
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
name: PowerShell Experimental Features Json Update
on:
workflow_dispatch:
schedule:
# At 13:00 UTC every day.
- cron: '0 13 * * *'
push:
branches: [ doesnotexist ]
defaults:
run:
shell: pwsh
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
POWERSHELL_TELEMETRY_OPTOUT: 1
jobs:
create-expjson-windows:
name: Update experimental features json
timeout-minutes: 15
runs-on: windows-latest
if: github.repository == 'PowerShell/PowerShell'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create experimental features file
run: |
Import-Module ./build.psm1 -Force
Import-Module ./.github/workflows/GHWorkflowHelper -Force
Start-PSBootstrap
Start-PSBuild -Clean -SkipExperimentalFeatureGeneration
$pwsh = Get-PSOutput
$getExpFeatureJsonScript = @'
[System.Collections.ArrayList] $expFeatures = Get-ExperimentalFeature | Where-Object Name -NE PS7DscSupport | ForEach-Object -MemberName Name
# Make sure ExperimentalFeatures from modules in PSHome are added
# https://github.com/PowerShell/PowerShell/issues/10550
$ExperimentalFeaturesFromGalleryModulesInPSHome = @()
$ExperimentalFeaturesFromGalleryModulesInPSHome | ForEach-Object {
if (!$expFeatures.Contains($_)) {
$null = $expFeatures.Add($_)
}
}
ConvertTo-Json $expFeatures
'@
$expFeaturesJson = & pwsh -c $getExpFeatureJsonScript
$expFeaturesJson | Out-File ./experimental-feature-windows-new.json -Force
if (Test-Path ./experimental-feature-windows.json) {
$currentExpFeatures = Get-Content ./experimental-feature-windows.json -Raw | ConvertFrom-Json
$newExpFeatures = Get-Content ./experimental-feature-windows-new.json -Raw | ConvertFrom-Json
if (-not (Compare-Object $currentExpFeatures $newExpFeatures)) {
Write-Verbose -Verbose "No changes to experimental features json file"
Set-GWVariable -Name CREATE_EXP_JSON_PR -Value 'false'
exit 0
}
}
Move-Item ./experimental-feature-windows-new.json ./experimental-feature-windows.json -Verbose
Set-GWVariable -Name CREATE_EXP_JSON_PR -Value 'true'
- name: Upload experimental features windows
uses: actions/upload-artifact@v2
with:
name: experimental-feature-windows-new.json
path: experimental-feature-windows-new.json
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
id: cpr
if: env.CREATE_EXP_JSON_PR == 'true'
with:
commit-message: "Update experimental-feature-windows.json"
title: "Update experimental-feature-windows.json"
base: master
branch: expjson_update_windows