Check JDT.UI For Breaking PRs #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check JDT.UI For Breaking PRs | |
on: | |
# schedule: | |
# - cron: '0 8 * * *' | |
workflow_dispatch: | |
jobs: | |
pr-verify-job: | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CC_LIST: '@rgrunber' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: 'eclipse-jdt/eclipse.jdt.ui' | |
fetch-depth: 2 | |
path: eclipse.jdt.ui | |
- uses: actions/checkout@v3 | |
with: | |
repository: 'eclipse-jdtls/eclipse.jdt.ls' | |
fetch-depth: 2 | |
path: eclipse.jdt.ls | |
- name: Cache Maven local repository | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2/repository | |
!~/.m2/repository/org/eclipse/jdt | |
key: maven-local-${{ hashFiles('eclipse.jdt.ui/pom.xml') }} | |
- name: Set Up Java | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5 | |
with: | |
maven-version: 3.9.4 | |
- name: | |
continue-on-error: true | |
run: | | |
PRS=`gh --repo=eclipse-jdt/eclipse.jdt.ui pr list --json number | jq .[].number` | |
set +e | |
for number in `echo ${PRS}`; do | |
touchesFiles=`gh --repo=eclipse-jdt/eclipse.jdt.ui pr view ${number} --json files | jq .files[].path | grep 'org.eclipse.jdt.core.manipulation' | wc -l` | |
alreadyCommented=`gh --repo=eclipse-jdt/eclipse.jdt.ui pr view ${number} --json comments | jq -r .comments[].body | grep 'eclipse-jdtls/eclipse.jdt.ls' | wc -l` | |
if [ "${touchesFiles}" != "0" ] && [ "${alreadyCommented}" == "0" ]; then | |
pushd eclipse.jdt.ui | |
git fetch origin pull/${number}/head | |
git checkout FETCH_HEAD | |
mvn -B clean install -Pbuild-individual-bundles -pl org.eclipse.jdt.core.manipulation | |
if [ $? -eq 0 ]; then | |
popd | |
pushd eclipse.jdt.ls | |
mvn -B clean verify -DskipTests | |
if [ $? -ne 0 ]; then | |
echo gh --repo=eclipse-jdt/eclipse.jdt.ui pr comment ${number} --body="This pull request may break the eclipse-jdtls/eclipse.jdt.ls project. CC'ing ${{ env.CC_LIST }} for awareness." | |
fi | |
fi | |
popd | |
fi | |
done | |
set -e |