Skip to content

Prepare for Release #97

Prepare for Release

Prepare for Release #97

#
# Copyright 2024 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Check Release Notes in PR comment
on:
pull_request:
types: [opened, synchronize, reopened, edited, labeled, unlabeled]
branches: [ master ]
jobs:
check-release-notes-comments:
runs-on: ubuntu-latest
steps:
- name: Fetch all PR comments
id: get-comments
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issueNumber = context.issue.number;
const repoName = context.repo.repo;
const repoOwner = context.repo.owner;
const comments = await github.rest.issues.listComments({
owner: repoOwner,
repo: repoName,
issue_number: issueNumber,
});
return comments.data.map(comment => comment.body);
- name: Check for 'Release Notes' in comments
uses: actions/github-script@v7
with:
script: |
const comments = ${{ steps.get-comments.outputs.result }};
const releaseNotesRegex = /release notes/i;
const hasReleaseNotes = comments.some(comment => releaseNotesRegex.test(comment));
if (!hasReleaseNotes) {
console.log('No "Release notes" found in PR comments');
core.setFailed('No "Release notes" found in PR comments')
} else {
console.log('"Release notes" found in comments');
}