Merge pull request #6 from tberchanov/fix_check-changelog #10
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: Android CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
check-changelog: | |
name: Ensure CHANGELOG.md is Updated | |
if: github.event_name == 'pull_request' # Run only on pull_request events | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Check for CHANGELOG.md changes | |
run: | | |
# Fetch the base branch to compare changes | |
git fetch origin ${{ github.base_ref }} --depth=1 | |
# Check if CHANGELOG.md has been modified | |
if git diff --name-only origin/master | grep -q "CHANGELOG.md"; then | |
echo "CHANGELOG.md has been updated." | |
else | |
echo "Error: CHANGELOG.md was not updated. Please update the CHANGELOG." | |
exit 1 | |
fi |