Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github-action: Add AsciiDoc freeze warning #356

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 14 additions & 29 deletions .github/workflows/comment-on-asciidoc-changes.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
---
name: Comment on PR for .asciidoc changes

on:
workflow_call: ~
pull_request:
types:
- synchronize
- opened
- reopened
branches:
- main
- master
- "9.0"

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.'
})
permissions:
contents: read
pull-requests: write
uses: elastic/docs-builder/.github/workflows/comment-on-asciidoc-changes.yml@main
Loading