Merge pull request #198 from domaframework/doc/update-plugin-description #105
This file contains hidden or 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: 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: | |
| check-commit-message: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.event.head_commit.message, 'Merge pull request') | |
| outputs: | |
| skip_job: ${{ steps.check.outputs.SKIP_JOB }} | |
| steps: | |
| - name: Check Commit Message | |
| id: check | |
| run: | | |
| if [[ "${{ github.event.head_commit.message }}" =~ ^Merge\ pull\ request\ #[0-9]+\ from\ ${{ github.repository_owner }}/doc/changelog-update-.*$ ]]; then | |
| echo "This commit is not target. Skip the workflow." | |
| echo "SKIP_JOB=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "SKIP_JOB=false" >> $GITHUB_OUTPUT | |
| fi | |
| update-changelog: | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.check-commit-message.outputs.skip_job != 'true' }} | |
| needs: [ check-commit-message ] | |
| 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 | |
| with: | |
| cache-read-only: true | |
| - name: Run Gradle updateChangelog | |
| id: updateChangelog | |
| run: | | |
| ./gradlew updateChangelog -PreleaseDate=$(date +'%Y-%m-%d') --no-configuration-cache | |
| 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 add gradle.properties | |
| 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 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 |