From 9dce32c65e6c304dfe8479c4dfbebb41ae1a6f7a Mon Sep 17 00:00:00 2001 From: AllyW Date: Thu, 23 Jan 2025 17:47:39 +0800 Subject: [PATCH] add git hook notice --- .github/template/git-hooks-note.md | 10 ++++++++++ .github/workflows/GitHookNotice.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/template/git-hooks-note.md create mode 100644 .github/workflows/GitHookNotice.yml diff --git a/.github/template/git-hooks-note.md b/.github/template/git-hooks-note.md new file mode 100644 index 00000000000..aeec70fd55a --- /dev/null +++ b/.github/template/git-hooks-note.md @@ -0,0 +1,10 @@ +The git hooks are available for **azure-cli** and **azure-cli-extensions** repos. They could help you run required checks before creating the PR. + +Please sync the latest code with latest dev branch (for **azure-cli**) or main branch (for **azure-cli-extensions**). +After that please run the following commands to enable git hooks: + +```bash +pip install azdev --upgrade +azdev setup -c -r + +``` diff --git a/.github/workflows/GitHookNotice.yml b/.github/workflows/GitHookNotice.yml new file mode 100644 index 00000000000..d5e9cb92a9e --- /dev/null +++ b/.github/workflows/GitHookNotice.yml @@ -0,0 +1,28 @@ +name: Git Hook Notice +on: + pull_request_target: + types: [opened] + branches: + - main + +permissions: {} + +jobs: + git-hook-notice: + runs-on: ubuntu-latest + permissions: + pull-requests: write + name: Introduce git hook in developer env + steps: + - name: Checkout git hook notice message + uses: actions/checkout@v4 + with: + sparse-checkout: | + .github/template/git-hooks-note.md + - name: Comment on pull request + uses: mshick/add-pr-comment@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + message-id: gitHookNoticeComment + message-path: | + .github/template/git-hooks-note.md