Skip to content

[pull] master from gradle:master #32

[pull] master from gradle:master

[pull] master from gradle:master #32

Workflow file for this run

name: Check commits
on:
merge_group:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
permissions: {}
jobs:
# See .github/workflows/CheckBadMerge.groovy for explanation
check_bad_merge:
if: github.event.pull_request.base.ref == 'master'
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install Groovy
run: sudo apt-get install groovy
- name: List PR commits
run: |
git log --pretty=format:"%H" ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} > pr_commits.txt
- name: Check PR commits
id: run_check
run: |
groovy .github/workflows/CheckBadMerge.groovy pr_commits.txt > output.txt 2>&1
- name: Read output file
id: read_output
if: ${{ always() }}
run: |
cat output.txt
OUTPUT=$(cat output.txt)
echo "OUTPUT<<EOF" >> $GITHUB_ENV
echo "$OUTPUT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Comment on PR if check failed
if: ${{ failure() }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `
Some bad merge is found:
\`\`\`
${{ env.OUTPUT }}
\`\`\`
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
# check that only released Gradle versions are used in the wrapper
check_wrapper:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check used wrapper
run: |
set -eu
for commit in $(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}); do
git checkout $commit --quiet --detach
WRAPPER_GRADLE_VERSION=$(grep "distributionUrl" gradle/wrapper/gradle-wrapper.properties | sed 's/.*gradle-\(.*\)-[a-z]*\.[a-z]*/\1/')
echo "Commit $commit wrapper: $WRAPPER_GRADLE_VERSION"
if ! [[ $WRAPPER_GRADLE_VERSION =~ ^[0-9.]+(-(rc|milestone|m)-[0-9]+)?$ ]]; then
RED="\e[31m"
ENDCOLOR="\e[0m"
>&2 echo -e "${RED}Bad wrapper version $WRAPPER_GRADLE_VERSION used in commit $commit.${ENDCOLOR} Please rebase your branch to ensure that each commit uses only released Gradle versions in wrapper (GA, RC or milestone)."
exit 1
fi
done