Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to check compatibility #8486

Merged
merged 3 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/check-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Check Compatibility

on:
pull_request_target
gaiksaya marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:
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
gaiksaya marked this conversation as resolved.
Show resolved Hide resolved

- name: Add comment on the PR
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ steps.github_app_token.outputs.token }}
issue-number: ${{ github.event.number }}
body-path: "${{ github.workspace }}/results.txt"
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class CheckCompatibilityTask extends DefaultTask {

@TaskAction
void checkCompatibility() {
logger.info("Checking compatibility for: $repositoryUrls for $ref")
repositoryUrls.parallelStream().forEach { repositoryUrl ->
logger.lifecycle("Checking compatibility for: $repositoryUrl with ref: $ref")
def tempDir = File.createTempDir()
try {
if (cloneAndCheckout(repositoryUrl, tempDir)) {
Expand Down Expand Up @@ -81,8 +81,16 @@ class CheckCompatibilityTask extends DefaultTask {

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

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

protected boolean cloneAndCheckout(repoUrl, directory) {
Expand Down