Skip to content

checking title

checking title #77

name: Update Changelog with new commit
permissions:
pull-requests: write
on:
pull_request:
# Inputs the workflow accepts.
types: [closed]
jobs:
pull-commit-message:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
message: ${{ steps.pull.outputs.message }}
steps:
- uses: actions/checkout@v4
- name: get merge commit message
id: pull
run: echo message="$(git log --pretty="format:%b")" >> $GITHUB_OUTPUT
# check-for-changelog-entry
changelog-entry:
# if contains to check for bug, enhancement, breaking change, feature
if: ${{ contains(needs.pull-commit-message.outputs.message, '[BUG]') || contains(needs.pull-commit-message.outputs.message, '[ENHANCEMENT]') || contains(needs.pull-commit-message.outputs.message, '[FEATURE]') || contains(needs.pull-commit-message.outputs.message, '[BREAKING]')}}
runs-on: ubuntu-latest
needs: pull-commit-message
outputs:
optIn: ${{ steps.in.outputs.bool }}
steps:
- name: changelog entry opt in
id: in
run: echo "opted in to changelog entry" | echo bool="true" >> $GITHUB_OUTPUT
# if there is a changelog entry, check for PR Open
update-changelog:
if: needs.changelog-entry.outputs.optIn
runs-on: ubuntu-latest
needs: changelog-entry
steps:
- name: Check if PR exists
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "gh pr list --repo "$GITHUB_REPOSITORY" --json title"
#prs=$(gh pr list \
#--repo "$GITHUB_REPOSITORY" \
#--json title \
#--jq '.[] | select(.title|test("xyz."))')
#if ((prs)); then
#echo "skip=true" >> "$GITHUB_OUTPUT"
#fi
- name: Create pull request
if: '!steps.check.outputs.skip'
run: echo "Creating a new pull request - debug"
# if changelog PR isn't already open, open one
#run: |
#gh pr create -B targetBranch -H source Branch