Skip to content

Support Git dependencies #175

Support Git dependencies

Support Git dependencies #175

# moon: The build system and package manager for MoonBit.
# Copyright (C) 2024 International Digital Economy Academy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# For inquiries, you can contact us via e-mail at [email protected].
name: Check for Merge Commits
on:
pull_request:
branches: main
jobs:
check-merge-commit:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Get all commit messages
id: get-commit-messages
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const commits = await github.rest.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
per_page: 100
});
const commitMessages = commits.data.map(commit => commit.commit.message);
const hasMergeCommit = commitMessages.some(message => message.startsWith('Merge branch') || message.startsWith('Merge pull request'));
if (hasMergeCommit) {
core.setFailed('Pull request contains merge commit(s).');
}
- name: Check for merge commits
if: failure()
run: echo "This pull request contains merge commit(s) and has been marked as failed."