correctly recognize running from root #241
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
# This workflow run pre-commit and amend version and commit info | |
# Before merging into master | |
name: Check Merge | |
on: | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
check-merge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 20 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
- name: Run Git Hooks | |
run: | | |
set -x | |
echo 'before' | |
cat cmd/xgo/version.go | |
go run ./script/git-hooks pre-commit --amend --no-commit | |
git status | |
echo 'after' | |
cat cmd/xgo/version.go | |
- name: Check If Git Hooks Generate No New Files | |
run: | | |
if ! git diff --quiet;then | |
echo "diff found after run 'go run ./script/git-hooks pre-commit --no-commit', ensure run git hooks before you commit" >&2 | |
exit 1 | |
fi | |
- name: Check If Can Merge Into Master Without Intermediate Commit | |
run: go run ./script/github-actions check-merge |