Skip to content

Commit b615c8f

Browse files
committed
Add reusable workflow
1 parent 6ce1cae commit b615c8f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Comment on PR for .asciidoc changes
2+
3+
on:
4+
workflow_call: ~
5+
6+
jobs:
7+
comment-on-asciidoc-change:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout the repository
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0 # This is important to fetch all history
15+
16+
- name: Check for changes in .asciidoc files
17+
id: check-files
18+
run: |
19+
git fetch origin ${{ github.base_ref }}
20+
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E '\.asciidoc$'; then
21+
echo "asciidoc_changed=true" >> $GITHUB_OUTPUT
22+
else
23+
echo "asciidoc_changed=false" >> $GITHUB_OUTPUT
24+
fi
25+
- name: Add a comment if .asciidoc files changed
26+
if: steps.check-files.outputs.asciidoc_changed == 'true'
27+
uses: actions/github-script@v6
28+
with:
29+
script: |
30+
github.rest.issues.createComment({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
issue_number: context.payload.pull_request.number,
34+
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.'
35+
})

0 commit comments

Comments
 (0)