Skip to content

Merge pull request #34 from domaframework/ci/changelog-update-action #1

Merge pull request #34 from domaframework/ci/changelog-update-action

Merge pull request #34 from domaframework/ci/changelog-update-action #1

name: Update Changelog PR
on:
push:
branches:
- 'main'
- 'releases/**'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
update-changelog:
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, 'Merge pull request')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run Gradle updateChangelog
run: |
./gradlew updateChangelog -PreleaseDate=$(date +'%Y-%m-%d')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Gradle checkExistChangelogPullRequest
run: |
./gradlew checkExistChangelogPullRequest -PnewBranch=$BRANCH
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push ChangeLog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
git checkout -b $BRANCH
git add CHANGELOG.md
git commit -am "Changelog update - $NEW_VERSION"
git push --set-upstream --force-with-lease origin $BRANCH
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ${{ env.EXIST_CHANGELOG == 'false' }} ; then
gh label create "$LABEL" \
--description "Pull requests with release changelog update" \
--force \
|| true
gh pr create \
--title "Changelog update - \`$NEW_VERSION\`" \
--body "Current pull request contains patched \`CHANGELOG.md\` for the \`$NEW_VERSION\` version.Please merge this Pull Request once you have completed all the changes you want included in the latest version." \
--label changelog,skip-changelog \
--head $BRANCH \
--draft
fi