Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya committed Jul 6, 2023
1 parent 1f99e33 commit 420f320
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/check-compatibility.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: checkCompatibility
name: Check Compatibility

on:
pull_request_target
Expand All @@ -9,20 +9,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run compatibility task
run: ./gradlew checkCompatibility | tee $HOME/gradlew-check.out

- name: Get results
run: |
echo 'Compatibility status:' > ${{ github.workspace }}/results.txt && echo '```' >> ${{ github.workspace }}/results.txt
grep -e 'Compatible components' -e 'Incompatible components' -e 'Components skipped' -A 2 -B 3 $HOME/gradlew-check.out >> "${{ github.workspace }}/results.txt"
echo '```' >> ${{ github.workspace }}/results.txt
- name: GitHub App token
id: github_app_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780

- name: Add comment on the PR
uses: peter-evans/create-or-update-comment@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ class CheckCompatibilityTask extends DefaultTask {

protected static List getRepoUrls() {
def json = new JsonSlurper().parse(REPO_URL.toURL())
def labels = json.projects.values()
def repoUrls = replaceSshWithHttps(labels as List)
def repository = json.projects.values()
def repoUrls = replaceSshWithHttps(repository as List)
return repoUrls
}

protected static replaceSshWithHttps(List<String> inputList) {
inputList.replaceAll { element ->
protected static replaceSshWithHttps(List<String> repoList) {
repoList.replaceAll { element ->
element.replace("[email protected]:", "https://github.com/")
}
return inputList
return repoList
}

protected boolean cloneAndCheckout(repoUrl, directory) {
Expand Down

0 comments on commit 420f320

Please sign in to comment.