Skip to content

Commit 14bc196

Browse files
committed
switching autoissue, stale, stalebranch workflows to config file
1 parent 04c4f7d commit 14bc196

File tree

3 files changed

+61
-10
lines changed

3 files changed

+61
-10
lines changed
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
11
name: (Scheduled) Auto issue assign
22

33
permissions:
4+
contents: read
45
issues: write
56

67
on:
78
schedule:
8-
- cron: "0 17 * * *"
9+
- cron: "26 21 * * *"
910

1011
workflow_dispatch:
1112

1213

1314
jobs:
1415

16+
config:
17+
if: github.repository_owner == 'MicrosoftDocs'
18+
runs-on: ubuntu-latest
19+
outputs:
20+
ExcludedUserList: ${{ steps.read.outputs.ExcludedUserList }}
21+
steps:
22+
- uses: actions/checkout@v5
23+
with:
24+
sparse-checkout: .github/workflow-config.json
25+
sparse-checkout-cone-mode: false
26+
- id: read
27+
shell: pwsh
28+
run: |
29+
$Config = (Get-Content '.github/workflow-config.json' | ConvertFrom-Json).AutoIssueAssign
30+
"ExcludedUserList=$($Config.ExcludedUserList | ConvertTo-Json -Compress)" >> $Env:GITHUB_OUTPUT
31+
1532
stale-branch:
1633
if: github.repository_owner == 'MicrosoftDocs'
34+
needs: config
1735
uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-AutoIssueAssign.yml@workflows-prod
1836
with:
1937
PayloadJson: ${{ toJSON(github) }}
20-
ExcludedUserList: '["user1", "user2"]'
21-
38+
ExcludedUserList: ${{ needs.config.outputs.ExcludedUserList }}
2239
secrets:
2340
AccessToken: ${{ secrets.GITHUB_TOKEN }}
2441
PrivateKey: ${{ secrets.M365_APP_PRIVATE_KEY }}
25-
ClientId: ${{ secrets.M365_APP_CLIENT_ID }}
42+
ClientId: ${{ secrets.M365_APP_CLIENT_ID }}

.github/workflows/Stale.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: (Scheduled) Mark stale pull requests
22

33
permissions:
4+
contents: read
45
issues: write
56
pull-requests: write
67

@@ -10,11 +11,28 @@ on:
1011
workflow_dispatch:
1112

1213
jobs:
14+
config:
15+
if: github.repository_owner == 'MicrosoftDocs'
16+
runs-on: ubuntu-latest
17+
outputs:
18+
RunDebug: ${{ steps.read.outputs.RunDebug }}
19+
steps:
20+
- uses: actions/checkout@v5
21+
with:
22+
sparse-checkout: .github/workflow-config.json
23+
sparse-checkout-cone-mode: false
24+
- id: read
25+
shell: pwsh
26+
run: |
27+
$Config = (Get-Content '.github/workflow-config.json' | ConvertFrom-Json).Stale
28+
"RunDebug=$("$($Config.RunDebug)".ToLower())" >> $Env:GITHUB_OUTPUT
29+
1330
stale:
1431
if: github.repository_owner == 'MicrosoftDocs'
32+
needs: config
1533
uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-Stale.yml@workflows-prod
1634
with:
17-
RunDebug: false
35+
RunDebug: ${{ fromJSON(needs.config.outputs.RunDebug) }}
1836
RepoVisibility: ${{ github.repository_visibility }}
1937
secrets:
2038
AccessToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/StaleBranch.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,31 @@ on:
1818

1919
jobs:
2020

21+
config:
22+
if: github.repository_owner == 'MicrosoftDocs'
23+
runs-on: ubuntu-latest
24+
outputs:
25+
RepoBranchSkipList: ${{ steps.read.outputs.RepoBranchSkipList }}
26+
ReportOnly: ${{ steps.read.outputs.ReportOnly }}
27+
steps:
28+
- uses: actions/checkout@v5
29+
with:
30+
sparse-checkout: .github/workflow-config.json
31+
sparse-checkout-cone-mode: false
32+
- id: read
33+
shell: pwsh
34+
run: |
35+
$Config = (Get-Content '.github/workflow-config.json' | ConvertFrom-Json).StaleBranch
36+
"RepoBranchSkipList=$($Config.RepoBranchSkipList | ConvertTo-Json -Compress)" >> $Env:GITHUB_OUTPUT
37+
"ReportOnly=$("$($Config.ReportOnly)".ToLower())" >> $Env:GITHUB_OUTPUT
38+
2139
stale-branch:
2240
if: github.repository_owner == 'MicrosoftDocs'
41+
needs: config
2342
uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-StaleBranch.yml@workflows-prod
2443
with:
2544
PayloadJson: ${{ toJSON(github) }}
26-
RepoBranchSkipList: '[
27-
"ExampleBranch1",
28-
"ExampleBranch2"
29-
]'
30-
ReportOnly: false
45+
RepoBranchSkipList: ${{ needs.config.outputs.RepoBranchSkipList }}
46+
ReportOnly: ${{ fromJSON(needs.config.outputs.ReportOnly) }}
3147
secrets:
3248
AccessToken: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)