Skip to content

Commit 180080d

Browse files
Vishal VaibhavGitHub Enterprise
authored andcommitted
Broken code fix (#31)
* githu org * adding plugin_key for github token * adding plugin_key for github token * adding plugin_key for github token * adding plugin_key for github token
1 parent 4e08579 commit 180080d

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

internal/plugin/runner.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ func (*DefaultRunner) Run(propertyGetter func(string) (string, bool), changedSou
5959

6060
ghAPIKey, ghAPIKeyFound := propertyGetter("PARAMETER_GH_API_KEY")
6161
if !ghAPIKeyFound {
62-
logrus.Info("PARAMETER_GH_API_KEY was missing, will not send report to PR comments")
62+
ghAPIKey, ghAPIKeyFound = propertyGetter("PLUGIN_GH_API_KEY")
63+
if !ghAPIKeyFound {
64+
logrus.Info("PARAMETER_GH_API_KEY/PLUGIN_GH_API_KEY was missing, will not send report to PR comments")
65+
}
6366
}
6467

6568
ghAPIBaseURL, ghAPIBaseURLFound := propertyGetter("PARAMETER_GH_API_BASE_URL")

internal/plugin/runner_test.go

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ func TestDefaultRunner_RunNoCoverageData(t *testing.T) {
522522
propGetter.On("GetProperty", "PARAMETER_COVERAGE_TYPE").Return("jacoco", true)
523523
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("src/main/java", true)
524524
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
525+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
525526
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
526527
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
527528
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
@@ -562,8 +563,7 @@ func TestDefaultRunner_RunErrOpeningCoverFile(t *testing.T) {
562563
propGetter.On("GetProperty", "PARAMETER_COVERAGE_TYPE").Return("jacoco", true)
563564
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("anything", true)
564565
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
565-
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
566-
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
566+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
567567
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
568568
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
569569
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
@@ -583,8 +583,7 @@ func TestDefaultRunner_RunBadUnified_UnfinishedBlock(t *testing.T) {
583583
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("src/main/java", true)
584584
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
585585
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
586-
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
587-
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
586+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
588587
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
589588
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
590589
propGetter.On("GetProperty", "REPOSITORY_NAME").Return("", false)
@@ -605,8 +604,7 @@ func TestDefaultRunner_RunBadUnified_UnfinishedBlock2(t *testing.T) {
605604
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("src/main/java", true)
606605
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
607606
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
608-
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
609-
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
607+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
610608
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
611609
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
612610
propGetter.On("GetProperty", "REPOSITORY_NAME").Return("", false)
@@ -627,8 +625,7 @@ func TestDefaultRunner_RunBadUnified_BadFilename(t *testing.T) {
627625
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("src/main/java", true)
628626
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
629627
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
630-
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
631-
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
628+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
632629
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
633630
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
634631
propGetter.On("GetProperty", "REPOSITORY_NAME").Return("", false)
@@ -649,8 +646,7 @@ func TestDefaultRunner_RunBadUnified_ExtraLinesBlock(t *testing.T) {
649646
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("src/main/java", true)
650647
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
651648
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
652-
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
653-
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
649+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
654650
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
655651
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
656652
propGetter.On("GetProperty", "REPOSITORY_NAME").Return("", false)
@@ -671,8 +667,7 @@ func TestDefaultRunner_RunBadUnified_AlphaInAtBlock(t *testing.T) {
671667
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("src/main/java", true)
672668
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
673669
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
674-
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
675-
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
670+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
676671
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
677672
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
678673
propGetter.On("GetProperty", "REPOSITORY_NAME").Return("", false)
@@ -694,8 +689,7 @@ func TestDefaultRunner_RunBadUnified_AlphaInAtBlock2(t *testing.T) {
694689
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("src/main/java", true)
695690
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
696691
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
697-
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
698-
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
692+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
699693
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
700694
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
701695
propGetter.On("GetProperty", "REPOSITORY_NAME").Return("", false)
@@ -717,8 +711,7 @@ func TestDefaultRunner_RunCoverageNotXml(t *testing.T) {
717711
propGetter.On("GetProperty", "PARAMETER_SOURCE_DIRS").Return("src/main/java", true)
718712
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
719713
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
720-
propGetter.On("GetProperty", "PARAMETER_GH_API_KEY").Return("", false)
721-
propGetter.On("GetProperty", "PARAMETER_GH_API_BASE_URL").Return("", false)
714+
propGetter.On("GetProperty", "PLUGIN_GH_API_KEY").Return("", false)
722715
propGetter.On("GetProperty", "BUILD_PULL_REQUEST_NUMBER").Return("", false)
723716
propGetter.On("GetProperty", "REPOSITORY_ORG").Return("", false)
724717
propGetter.On("GetProperty", "REPOSITORY_NAME").Return("", false)

0 commit comments

Comments
 (0)