File tree Expand file tree Collapse file tree 2 files changed +34
-15
lines changed Expand file tree Collapse file tree 2 files changed +34
-15
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,15 @@ branding:
7
7
color : blue
8
8
9
9
inputs :
10
+ token :
11
+ description : ' GitHub token with repo scope.'
12
+ required : true
13
+ owner :
14
+ description : ' owner of repo.'
15
+ required : true
16
+ repo :
17
+ description : ' The name of the repository.'
18
+ required : true
10
19
pattern :
11
20
description : ' Keyword to match for deletion.'
12
21
required : true
15
24
using : docker
16
25
image : Dockerfile
17
26
args :
27
+ - ${{ inputs.token }}
28
+ - ${{ inputs.owner }}
29
+ - ${{ inputs.repo }}
18
30
- ${{ inputs.pattern }}
Original file line number Diff line number Diff line change 1
1
2
2
param (
3
- [string ]$pattern = $env: INPUT_PATTERN
3
+ [string ]$Token = $env: INPUT_TOKEN ,
4
+ [string ]$Owner = $env: INPUT_OWNER ,
5
+ [string ]$Repo = $env: INPUT_REPO ,
6
+ [string ]$Pattern = $env: INPUT_PATTERN
4
7
)
5
- $ErrorActionPreference = " Stop"
6
- try {
7
-
8
- $githubContext = $env: GITHUB_CONTEXT | ConvertFrom-Json
9
-
10
- $prTitle = $githubContext.event.pull_request.title
11
- if (-not ($prTitle -match $pattern )) {
12
- throw " PR title '$prTitle ' does not match the pattern '$pattern '."
13
- } else {
14
- Write-Output " PR title '$prTitle ' matches the pattern '$pattern '."
15
- }
16
- } catch {
17
- Write-Error $_.Exception.Message
18
- exit 1
8
+
9
+
10
+ $headers = @ {
11
+ Authorization = " Bearer $Token "
19
12
}
13
+
14
+ Write-Host " $Token , $Owner , $Pattern , $Repo "
15
+
16
+ $prUrl = " https://api.github.com/repos/$Owner /$Repo /pulls"
17
+ # $prs = Invoke-RestMethod -Uri $prUrl -Headers $headers
18
+ $pr = Invoke-RestMethod - Uri $prUrl - Headers $headers
19
+ # foreach ($pr in $prs) {
20
+ $prTitle = $pr.title
21
+ if ($prTitle -match $Pattern ) {
22
+ Write-Host " PR #$ ( $pr.number ) : Title is valid: $prTitle "
23
+ } else {
24
+ Write-Host " PR #$ ( $pr.number ) : Invalid title: $prTitle "
25
+ }
26
+ # }
You can’t perform that action at this time.
0 commit comments