Browse Source

Analysis: fix checkout and commit generation

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas 3 years ago
parent
commit
494cceab8e
3 changed files with 10 additions and 16 deletions
  1. 8 6
      .github/workflows/analysis.yml
  2. 1 3
      scripts/analysis/findbugs-up.rb
  3. 1 7
      scripts/analysis/lint-up.rb

+ 8 - 6
.github/workflows/analysis.yml

@@ -10,12 +10,6 @@ jobs:
     analysis:
         runs-on: ubuntu-latest
         steps:
-            -   uses: actions/checkout@v2
-            -   name: Set up JDK 11
-                uses: actions/setup-java@v2
-                with:
-                    distribution: "temurin"
-                    java-version: 11
             -   name: Setup variables
                 id: get-vars
                 run: |
@@ -33,6 +27,14 @@ jobs:
                     echo "BRANCH: ${{ steps.get-vars.outputs.branch }}"
                     echo "PR: ${{ steps.get-vars.outputs.pr }}"
                     echo "RUN NUMBER: $GITHUB_RUN_NUMBER"
+            -   uses: actions/checkout@v2
+                with:
+                    ref: ${{ steps.get-vars.outputs.branch }}
+            -   name: Set up JDK 11
+                uses: actions/setup-java@v2
+                with:
+                    distribution: "temurin"
+                    java-version: 11
             -   name: Run analysis wrapper
                 run: |
                     mkdir -p $HOME/.gradle

+ 1 - 3
scripts/analysis/findbugs-up.rb

@@ -110,8 +110,6 @@ previous_git_email = previous_git_email.strip
 # update git user name and email for this script
 system ("git config --local user.name '"  + git_user + "'")
 system ("git config --local user.email 'android@nextcloud.com'")
-system ("git remote rm origin")
-system ("git remote add origin https://" + git_user + ":" + git_token + "@github.com/nextcloud/android")
 
 # add previous FindBugs result file to git
 system ('git add ' + PREVIOUS_FINDBUGS_RESULTS_FILE)
@@ -120,7 +118,7 @@ system ('git add ' + PREVIOUS_FINDBUGS_RESULTS_FILE)
 system({"GIT_COMMITTER_EMAIL" => "drone@nextcloud.com", "GIT_AUTHOR_EMAIL" => "drone@nextcloud.com"}, 'git commit -sm "Drone: update FindBugs results to reflect reduced error/warning count [skip ci]"')
 
 # push to origin
-system ('git push origin HEAD:' + git_branch)
+system ('git push')
 
 # restore previous git user name and email
 system("git config --local user.name '#{previous_git_username}'")

+ 1 - 7
scripts/analysis/lint-up.rb

@@ -179,8 +179,6 @@ previous_git_email = previous_git_email.strip
 # update git user name and email for this script
 system ("git config --local user.name '"  + git_user + "'")
 system ("git config --local user.email 'android@nextcloud.com'")
-system ("git remote rm origin")
-system ("git remote add origin https://" + git_user + ":" + git_token + "@github.com/nextcloud/android")
 
 # add previous Lint result file to git
 system ('git add ' + PREVIOUS_LINT_RESULTS_FILE)
@@ -189,11 +187,7 @@ system ('git add ' + PREVIOUS_LINT_RESULTS_FILE)
 system({"GIT_COMMITTER_EMAIL" => "drone@nextcloud.com", "GIT_AUTHOR_EMAIL" => "drone@nextcloud.com"}, 'git commit -sm "Drone: update Lint results to reflect reduced error/warning count [skip ci]"')
 
 # push to origin
-system ('git push origin HEAD:' + git_branch)
-
-# restore previous git user name and email
-system("git config --local user.name '#{previous_git_username}'")
-system("git config --local user.email '#{previous_git_email}'")
+system ('git push')
 
 puts "SUCCESS: count was reduced"
 exit 0 # success