Skip to content

Update Actions dependency #135

Update Actions dependency

Update Actions dependency #135

Workflow file for this run

#
# Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>
#
# 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
#
# https://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 conflict
on:
pull_request:
jobs:
dump-contexts-to-log:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/dump-context
check-conflict:
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.DISPATCH_TOKEN }}
- name: Set Git config
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Check conflict
run: |
if grep -r "<<<< HEAD" . --exclude-dir=.git --exclude=check-conflict.yaml; then
PR_COMMENTS=`curl ${API_URL}?per_page=10000`
BODY=`echo -E "${PR_COMMENTS}" | jq 'last(.[] | select(.user.login == "vdaas-ci") | select(.body | test("^\\\\*\\\\*\\\\[WARNING:CONFLICT")) | .body)' -r`
if [ "${BODY}" = "null" ]; then
curl --include --verbose --fail \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
--request POST \
--data "{\"body\": \"**[WARNING:CONFLICT]** You may require to fix the conflict. Please check.\"}" \
${API_URL}
fi
echo "Please fix conflict locally."
exit 1
else
echo "Nothing conflict"
fi
env:
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
API_URL: ${{ github.event.pull_request.comments_url }}