Skip to content

Commit b8fe8b2

Browse files
authored
Run compatibility check based on PR base branch (opensearch-project#9374)
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
1 parent d1678ba commit b8fe8b2

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

.github/workflows/check-compatibility.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ on:
55
pull_request_target
66

77
jobs:
8-
build:
8+
check-compatibility:
99
if: github.repository == 'opensearch-project/OpenSearch'
10+
permissions:
11+
contents: read
1012
runs-on: ubuntu-latest
1113
steps:
1214
- uses: actions/checkout@v3
15+
with:
16+
ref: ${{ github.event.pull_request.head.sha }}
1317

1418
- name: Run compatibility task
1519
run: ./gradlew checkCompatibility -i | tee $HOME/gradlew-check.out
@@ -22,17 +26,25 @@ jobs:
2226
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"
2327
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"
2428
25-
- name: GitHub App token
26-
id: github_app_token
27-
uses: tibdex/github-app-token@v1.6.0
29+
- name: Upload results
30+
uses: actions/upload-artifact@v3
31+
with:
32+
name: results.txt
33+
path: ${{ github.workspace }}/results.txt
34+
35+
add-comment:
36+
needs: [check-compatibility]
37+
permissions:
38+
pull-requests: write
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Download results
42+
uses: actions/download-artifact@v3
2843
with:
29-
app_id: ${{ secrets.APP_ID }}
30-
private_key: ${{ secrets.APP_PRIVATE_KEY }}
31-
installation_id: 22958780
44+
name: results.txt
3245

3346
- name: Add comment on the PR
3447
uses: peter-evans/create-or-update-comment@v3
3548
with:
36-
token: ${{ steps.github_app_token.outputs.token }}
3749
issue-number: ${{ github.event.number }}
38-
body-path: "${{ github.workspace }}/results.txt"
50+
body-path: results.txt

0 commit comments

Comments
 (0)