Skip to content

Commit

Permalink
Clean up PreGate check (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
aholstrup1 authored Aug 3, 2023
1 parent adaf03e commit d411e62
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 47 deletions.
4 changes: 0 additions & 4 deletions Actions/VerifyPRChanges/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Verify PR Changes for AL-Go workflows
## Parameters
### token (default github.token)
The GitHub token running the action
### baseSHA (default github.event.pull_request.base.sha)
Base commit of the PR
### headSHA (default github.event.pull_request.head.sha)
Head commit of the PR
### prBaseRepository (default github.event.pull_request.base.repo.full_name)
The name of the repository the PR is going to
### pullRequestId (default github.event.pull_request.number)
Expand Down
4 changes: 0 additions & 4 deletions Actions/VerifyPRChanges/VerifyPRChanges.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Param(
[Parameter(HelpMessage = "The token to use for the GitHub API", Mandatory = $false)]
[string] $token,
[Parameter(HelpMessage = "Base commit of the PR", Mandatory = $false)]
[string] $baseSHA,
[Parameter(HelpMessage = "Head commit of the PR", Mandatory = $false)]
[string] $headSHA,
[Parameter(HelpMessage = "The name of the repository the PR is going to", Mandatory = $false)]
[string] $prBaseRepository,
[Parameter(HelpMessage = "The id of the pull request", Mandatory = $false)]
Expand Down
12 changes: 1 addition & 11 deletions Actions/VerifyPRChanges/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ inputs:
description: The token to use for the GitHub API
required: false
default: ${{ github.token }}
baseSHA:
description: Base commit of the PR
required: false
default: ${{ github.event.pull_request.base.sha }}
headSHA:
description: Head commit of the PR
required: false
default: ${{ github.event.pull_request.head.sha }}
prBaseRepository:
description: The name of the repository the PR is going to
required: false
Expand All @@ -32,11 +24,9 @@ runs:
shell: ${{ inputs.shell }}
env:
_token: ${{ inputs.token }}
_baseSHA: ${{ inputs.baseSHA }}
_headSHA: ${{ inputs.headSHA }}
_prBaseRepository: ${{ inputs.prBaseRepository }}
_pullRequestId: ${{ inputs.pullRequestId }}
run: try { ${{ github.action_path }}/VerifyPRChanges.ps1 -token $ENV:_token -baseSHA $ENV:_baseSHA -headSHA $ENV:_headSHA -prBaseRepository $ENV:_prBaseRepository -pullRequestId $ENV:_pullRequestId } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("*",'').Replace("*",' ')))"; exit 1 }
run: try { ${{ github.action_path }}/VerifyPRChanges.ps1 -token $ENV:_token -prBaseRepository $ENV:_prBaseRepository -pullRequestId $ENV:_pullRequestId } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("*",'').Replace("*",' ')))"; exit 1 }
branding:
icon: terminal
color: blue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ jobs:
ref: refs/pull/${{ github.event.number }}/merge

- uses: microsoft/AL-Go-Actions/VerifyPRChanges@main
with:
baseSHA: ${{ github.event.pull_request.base.sha }}
headSHA: ${{ github.event.pull_request.head.sha }}
prbaseRepository: ${{ github.event.pull_request.base.repo.full_name }}

Initialization:
needs: [ PregateCheck ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ jobs:
ref: refs/pull/${{ github.event.number }}/merge

- uses: microsoft/AL-Go-Actions/VerifyPRChanges@main
with:
baseSHA: ${{ github.event.pull_request.base.sha }}
headSHA: ${{ github.event.pull_request.head.sha }}
prbaseRepository: ${{ github.event.pull_request.base.repo.full_name }}

Initialization:
needs: [ PregateCheck ]
Expand Down
20 changes: 0 additions & 20 deletions Tests/VerifyPRChanges.Action.Test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Describe 'VerifyPRChanges Action Tests' {

{
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -31,8 +29,6 @@ Describe 'VerifyPRChanges Action Tests' {

{
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -45,8 +41,6 @@ Describe 'VerifyPRChanges Action Tests' {

{
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -59,8 +53,6 @@ Describe 'VerifyPRChanges Action Tests' {

{
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -73,8 +65,6 @@ Describe 'VerifyPRChanges Action Tests' {

{
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -87,8 +77,6 @@ Describe 'VerifyPRChanges Action Tests' {

{
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -101,8 +89,6 @@ Describe 'VerifyPRChanges Action Tests' {

Mock Write-Host {}
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -115,8 +101,6 @@ Describe 'VerifyPRChanges Action Tests' {

Mock Write-Host {}
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -129,8 +113,6 @@ Describe 'VerifyPRChanges Action Tests' {

Mock Write-Host {}
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand All @@ -142,8 +124,6 @@ Describe 'VerifyPRChanges Action Tests' {

{
& $scriptPath `
-baseSHA "123" `
-headSHA "456" `
-prBaseRepository "microsoft/AL-Go" `
-pullRequestId "123456" `
-token "ABC"
Expand Down

0 comments on commit d411e62

Please sign in to comment.