mirror of https://github.com/status-im/consul.git
ci:check that type/docs-cherrypick is attached to website PR changes (#9690)
This commit is contained in:
parent
6b92b778c5
commit
7f455b9a42
|
@ -14,6 +14,7 @@ on:
|
||||||
- release/*
|
- release/*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
# checks that a .changelog entry is present for a PR
|
||||||
changelog-check:
|
changelog-check:
|
||||||
# If there a `pr/no-changelog` label we ignore this check
|
# If there a `pr/no-changelog` label we ignore this check
|
||||||
if: "!${{ contains(github.event.pull_request.label.*.name, 'pr/no-changelog')}}"
|
if: "!${{ contains(github.event.pull_request.label.*.name, 'pr/no-changelog')}}"
|
||||||
|
@ -27,7 +28,7 @@ jobs:
|
||||||
- name: Check for changelog entry in diff
|
- name: Check for changelog entry in diff
|
||||||
run: |
|
run: |
|
||||||
# check if there is a diff in the .changelog directory
|
# check if there is a diff in the .changelog directory
|
||||||
changelog_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "${{ github.event.pull_request.base.ref }}")" -- .changelog/)
|
changelog_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "origin/${{ github.event.pull_request.base.ref }}")" -- .changelog/)
|
||||||
|
|
||||||
# If we do not find a file in .changelog/, we post a comment to the PR
|
# If we do not find a file in .changelog/, we post a comment to the PR
|
||||||
if [ -z "$changelog_files" ]; then
|
if [ -z "$changelog_files" ]; then
|
||||||
|
@ -41,3 +42,30 @@ jobs:
|
||||||
else
|
else
|
||||||
echo "changelog-check: Found .changelog entry in PR!"
|
echo "changelog-check: Found .changelog entry in PR!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# checks that a 'type/docs-cherrypick' label is attached to PRs with website/ changes
|
||||||
|
website-check:
|
||||||
|
# If there's a `type/docs-cherrypick` label we ignore this check
|
||||||
|
if: "!${{ contains(github.event.pull_request.label.*.name, 'type/docs-cherrypick')}}"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
fetch-depth: 0 # by default the checkout action doesn't checkout all branches
|
||||||
|
- name: Check for website/ dir change in diff
|
||||||
|
run: |
|
||||||
|
# check if there is a diff in the website/ directory
|
||||||
|
website_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "origin/${{ github.event.pull_request.base.ref }}")" -- website/)
|
||||||
|
|
||||||
|
# If we find changed files in the website/ directory, we post a comment to the PR
|
||||||
|
if [ -n "$website_files" ]; then
|
||||||
|
# post PR comment to GitHub to check if a 'type/docs-cherrypick' label needs to be applied to the PR
|
||||||
|
echo "website-check: Did not find a 'type/docs-cherrypick' label, posting a reminder in the PR"
|
||||||
|
github_message="🤔 This PR has changes in the `website/` directory but does not have a `type/docs-cherrypick` label. If the changes are for the next version, this can be ignored. If they are updates to current docs, attach the label to auto cherrypick to the `stable-website` branch after merging."
|
||||||
|
curl -f -s -H "Authorization: token ${{ secrets.PR_COMMENT_TOKEN }}" \
|
||||||
|
-X POST \
|
||||||
|
-d "{ \"body\": \"${github_message}\"}" \
|
||||||
|
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments"
|
||||||
|
fi
|
Loading…
Reference in New Issue