Skip to content

Commit 1031349

Browse files
committed
github-action: Add AsciiDoc freeze warning
1 parent 9e7b896 commit 1031349

File tree

1 file changed

+14
-29
lines changed

1 file changed

+14
-29
lines changed
Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
1+
---
12
name: Comment on PR for .asciidoc changes
23

34
on:
4-
workflow_call: ~
5+
pull_request:
6+
types:
7+
- synchronize
8+
- opened
9+
- reopened
10+
branches:
11+
- main
12+
- master
13+
- "9.0"
514

615
jobs:
716
comment-on-asciidoc-change:
8-
runs-on: ubuntu-latest
9-
10-
steps:
11-
- name: Checkout the repository
12-
uses: actions/checkout@v4
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-
})
17+
permissions:
18+
contents: read
19+
pull-requests: write
20+
uses: elastic/docs-builder/.github/workflows/comment-on-asciidoc-changes.yml@main

0 commit comments

Comments
 (0)