-
Notifications
You must be signed in to change notification settings - Fork 2
35 lines (31 loc) · 1.33 KB
/
comment-on-asciidoc-changes.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Comment on PR for .asciidoc changes
on:
workflow_call: ~
jobs:
comment-on-asciidoc-change:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # This is important to fetch all history
- name: Check for changes in .asciidoc files
id: check-files
run: |
git fetch origin ${{ github.base_ref }}
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E '\.asciidoc$'; then
echo "asciidoc_changed=true" >> $GITHUB_OUTPUT
else
echo "asciidoc_changed=false" >> $GITHUB_OUTPUT
fi
- name: Add a comment if .asciidoc files changed
if: steps.check-files.outputs.asciidoc_changed == 'true'
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: 'It looks like this PR modifies one or more `.asciidoc` files. The documentation is currently under a documentation freeze. Please do not merge this PR. See the [migration guide](https://elastic.github.io/docs-builder/migration/index.html) to learn more.'
})