Skip to content

Commit 9e1b43f

Browse files
authored
Introduces change detection job and a "ready to merge" running on Linux to avoid macOS runner congestion (#1270)
* Update PR-powershell-lts.yml * Add 'ready_to_merge' job to workflow * Update .github/workflows/PR-powershell-lts.yml * Update PR-powershell-preview.yml * Update PR-powershell.yml * Update PR-powershell-daily.yml * Update workflow names and dependencies
1 parent 3a93686 commit 9e1b43f

File tree

4 files changed

+161
-8
lines changed

4 files changed

+161
-8
lines changed

.github/workflows/PR-powershell-daily.yml

+41
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,39 @@ env:
2828
HOMEBREW_NO_INSTALL_CLEANUP: 1
2929

3030
jobs:
31+
changes:
32+
if: startsWith(github.repository_owner, 'azure') || github.repository_owner == 'PowerShell'
33+
name: Change Detection
34+
runs-on: ubuntu-latest
35+
# Required permissions
36+
permissions:
37+
pull-requests: read
38+
# Set job outputs to values from filter step
39+
outputs:
40+
source: ${{ steps.filter.outputs.workflows }}
41+
steps:
42+
- name: checkout
43+
uses: actions/checkout@v4
44+
45+
# For pull requests it's not necessary to checkout the code
46+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.2.0
47+
id: filter
48+
with:
49+
list-files: json
50+
filters: |
51+
workflows:
52+
- '.github/workflows/PR-powershell-lts.yml'
53+
- 'Formula/powershell-lts.rb'
54+
55+
- name: Capture outputs
56+
run: |
57+
"workflows: ${{ steps.filter.outputs.workflows }}"
58+
shell: pwsh
59+
3160
homebrew-formula-daily:
3261
timeout-minutes: 15
62+
needs: changes
63+
if: ${{ needs.changes.outputs.workflows == 'true' }}
3364
runs-on: macos-latest
3465
steps:
3566
- name: Checkout
@@ -51,3 +82,13 @@ jobs:
5182
- name: Install and Test Formula
5283
if: steps.filter.outputs.workflows == 'true'
5384
uses: ./.github/workflows/composite/installAndTest
85+
86+
ready_to_merge:
87+
name: Daily ready to merge
88+
needs:
89+
- homebrew-formula-daily
90+
- changes
91+
if: always()
92+
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@v1.0.0
93+
with:
94+
needs_context: ${{ toJson(needs) }}

.github/workflows/PR-powershell-lts.yml

+38-8
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,56 @@ env:
2626
HOMEBREW_NO_INSTALL_CLEANUP: 1
2727

2828
jobs:
29-
homebrew-formula-lts:
30-
timeout-minutes: 15
31-
runs-on: macos-latest
29+
changes:
30+
if: startsWith(github.repository_owner, 'azure') || github.repository_owner == 'PowerShell'
31+
name: Change Detection
32+
runs-on: ubuntu-latest
33+
# Required permissions
34+
permissions:
35+
pull-requests: read
36+
# Set job outputs to values from filter step
37+
outputs:
38+
source: ${{ steps.filter.outputs.workflows }}
3239
steps:
33-
- name: Checkout
40+
- name: checkout
3441
uses: actions/checkout@v4
3542

36-
- name: Check for applicable files
37-
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
43+
# For pull requests it's not necessary to checkout the code
44+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.2.0
3845
id: filter
3946
with:
47+
list-files: json
4048
filters: |
4149
workflows:
4250
- '.github/workflows/PR-powershell-lts.yml'
4351
- 'Formula/powershell-lts.rb'
4452
53+
- name: Capture outputs
54+
run: |
55+
"workflows: ${{ steps.filter.outputs.workflows }}"
56+
shell: pwsh
57+
58+
homebrew-formula-lts:
59+
timeout-minutes: 15
60+
needs: changes
61+
if: ${{ needs.changes.outputs.workflows == 'true' }}
62+
runs-on: macos-latest
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
4567
- name: Prepare Agent
46-
if: steps.filter.outputs.workflows == 'true'
4768
uses: ./.github/workflows/composite/prep
4869

4970
- name: Install and Test Formula
50-
if: steps.filter.outputs.workflows == 'true'
5171
uses: ./.github/workflows/composite/installAndTest
72+
73+
ready_to_merge:
74+
name: LTS ready to merge
75+
needs:
76+
- homebrew-formula-lts
77+
- changes
78+
if: always()
79+
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@v1.0.0
80+
with:
81+
needs_context: ${{ toJson(needs) }}

.github/workflows/PR-powershell-preview.yml

+41
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,39 @@ env:
2626
HOMEBREW_NO_INSTALL_CLEANUP: 1
2727

2828
jobs:
29+
changes:
30+
if: startsWith(github.repository_owner, 'azure') || github.repository_owner == 'PowerShell'
31+
name: Change Detection
32+
runs-on: ubuntu-latest
33+
# Required permissions
34+
permissions:
35+
pull-requests: read
36+
# Set job outputs to values from filter step
37+
outputs:
38+
source: ${{ steps.filter.outputs.workflows }}
39+
steps:
40+
- name: checkout
41+
uses: actions/checkout@v4
42+
43+
# For pull requests it's not necessary to checkout the code
44+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.2.0
45+
id: filter
46+
with:
47+
list-files: json
48+
filters: |
49+
workflows:
50+
- '.github/workflows/PR-powershell-lts.yml'
51+
- 'Formula/powershell-lts.rb'
52+
53+
- name: Capture outputs
54+
run: |
55+
"workflows: ${{ steps.filter.outputs.workflows }}"
56+
shell: pwsh
57+
2958
homebrew-formula-preview:
3059
timeout-minutes: 15
60+
needs: changes
61+
if: ${{ needs.changes.outputs.workflows == 'true' }}
3162
runs-on: macos-latest
3263
steps:
3364
- name: Checkout
@@ -49,3 +80,13 @@ jobs:
4980
- name: Install and Test Formula
5081
if: steps.filter.outputs.workflows == 'true'
5182
uses: ./.github/workflows/composite/installAndTest
83+
84+
ready_to_merge:
85+
name: Preview ready to merge
86+
needs:
87+
- homebrew-formula-preview
88+
- changes
89+
if: always()
90+
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@v1.0.0
91+
with:
92+
needs_context: ${{ toJson(needs) }}

.github/workflows/PR-powershell.yml

+41
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,39 @@ env:
2828
HOMEBREW_NO_INSTALL_CLEANUP: 1
2929

3030
jobs:
31+
changes:
32+
if: startsWith(github.repository_owner, 'azure') || github.repository_owner == 'PowerShell'
33+
name: Change Detection
34+
runs-on: ubuntu-latest
35+
# Required permissions
36+
permissions:
37+
pull-requests: read
38+
# Set job outputs to values from filter step
39+
outputs:
40+
source: ${{ steps.filter.outputs.workflows }}
41+
steps:
42+
- name: checkout
43+
uses: actions/checkout@v4
44+
45+
# For pull requests it's not necessary to checkout the code
46+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.2.0
47+
id: filter
48+
with:
49+
list-files: json
50+
filters: |
51+
workflows:
52+
- '.github/workflows/PR-powershell-lts.yml'
53+
- 'Formula/powershell-lts.rb'
54+
55+
- name: Capture outputs
56+
run: |
57+
"workflows: ${{ steps.filter.outputs.workflows }}"
58+
shell: pwsh
59+
3160
homebrew-formula-stable:
3261
timeout-minutes: 15
62+
needs: changes
63+
if: ${{ needs.changes.outputs.workflows == 'true' }}
3364
runs-on: macos-latest
3465
steps:
3566
- name: Checkout
@@ -60,3 +91,13 @@ jobs:
6091
- name: Install and Test Formula
6192
if: steps.filter.outputs.workflows == 'true'
6293
uses: ./.github/workflows/composite/installAndTest
94+
95+
ready_to_merge:
96+
name: Stable ready to merge
97+
needs:
98+
- homebrew-formula-stable
99+
- changes
100+
if: always()
101+
uses: PowerShell/compliance/.github/workflows/ready-to-merge.yml@v1.0.0
102+
with:
103+
needs_context: ${{ toJson(needs) }}

0 commit comments

Comments
 (0)