Skip to content

Commit 63fa880

Browse files
committed
update gh action docs and template
1 parent 552b631 commit 63fa880

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/source/migration/freeze/gh-action.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ This GitHub Action enforces documentation freezes by adding comments to pull req
1010
2. **Check Changes**: It checks the diff between the latest commits to detect modifications to `.asciidoc` files.
1111
3. **Add Comment**: If changes are detected, the Action posts a comment in the pull request, reminding the contributor of the freeze.
1212

13+
This template was tested in https://github.com/elastic/observability-docs/pull/4768.
14+
1315
```yaml
1416
name: Comment on PR for .asciidoc changes
1517

@@ -31,16 +33,18 @@ jobs:
3133
steps:
3234
- name: Checkout the repository
3335
uses: actions/checkout@v3
36+
with:
37+
fetch-depth: 0 # This is important to fetch all history
3438

3539
- name: Check for changes in .asciidoc files
3640
id: check-files
3741
run: |
38-
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E '\.asciidoc$'; then
42+
git fetch origin ${{ github.base_ref }}
43+
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E '\.asciidoc$'; then
3944
echo "asciidoc_changed=true" >> $GITHUB_ENV
4045
else
4146
echo "asciidoc_changed=false" >> $GITHUB_ENV
4247
fi
43-
4448
- name: Add a comment if .asciidoc files changed
4549
if: env.asciidoc_changed == 'true'
4650
uses: actions/github-script@v6
@@ -50,6 +54,5 @@ jobs:
5054
owner: context.repo.owner,
5155
repo: context.repo.repo,
5256
issue_number: context.payload.pull_request.number,
53-
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 [link](link) to learn more.'
54-
});
57+
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.'
5558
```

0 commit comments

Comments
 (0)