Skip to content

Commit

Permalink
Run compatibility check based on PR base branch (opensearch-project#9374
Browse files Browse the repository at this point in the history
)

Signed-off-by: Sayali Gaikawad <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
  • Loading branch information
gaiksaya authored and shiv0408 committed Apr 25, 2024
1 parent a8f95fc commit eb4bdfe
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/check-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ on:
pull_request_target

jobs:
build:
check-compatibility:
if: github.repository == 'opensearch-project/OpenSearch'
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Run compatibility task
run: ./gradlew checkCompatibility -i | tee $HOME/gradlew-check.out
Expand All @@ -22,17 +26,25 @@ jobs:
echo "### Skipped components" >> "${{ github.workspace }}/results.txt" && grep -e 'Skipped component' $HOME/gradlew-check.out | sed -e 's/Skipped component: \[\(.*\)\]/- \1/' >> "${{ github.workspace }}/results.txt"
echo "### Compatible components" >> "${{ github.workspace }}/results.txt" && grep -e 'Compatible component' $HOME/gradlew-check.out | sed -e 's/Compatible component: \[\(.*\)\]/- \1/' >> "${{ github.workspace }}/results.txt"
- name: GitHub App token
id: github_app_token
uses: tibdex/[email protected]
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: results.txt
path: ${{ github.workspace }}/results.txt

add-comment:
needs: [check-compatibility]
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Download results
uses: actions/download-artifact@v3
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780
name: results.txt

- 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"
body-path: results.txt

0 comments on commit eb4bdfe

Please sign in to comment.