forked from Azure/Azure-Sentinel
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (36 loc) · 1.24 KB
/
checkAutomatedPR.yaml
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
name: Check if Automated Pull Request
on:
workflow_call:
outputs:
isAutomatedPR:
description: "Is Automated PR"
value: ${{ jobs.checkAutomatedPR.outputs.isAutomatedPR }}
permissions:
contents: read
pull-requests: read
env:
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}
BODY: ${{ github.event.issue.body }}
jobs:
checkAutomatedPR:
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
outputs:
isAutomatedPR: ${{ steps.ValidateAutomatedPR.outputs.isAutomatedPR }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
with:
fetch-depth: 2
ref: "${{ env.BRANCH_NAME }}"
- shell: pwsh
id: ValidateAutomatedPR
run: |
$prBodyContent = '${{ env.BODY }}'
$isAutomatedPR = $false
if ($prBodyContent -like '*Automation have successfully*')
{
Write-Host "This Pull Request is autogenerated!"
$isAutomatedPR = $true
}
Write-Output "isAutomatedPR=$isAutomatedPR" >> $env:GITHUB_OUTPUT
Write-Host "Is this Pull Request autogenerated $isAutomatedPR"