diff options
author | dragfire <[email protected]> | 2020-08-24 22:17:00 +0100 |
---|---|---|
committer | dragfire <[email protected]> | 2020-08-31 19:29:07 +0100 |
commit | cdebf02e5490989efc159cd1b4bc0645713e1dfc (patch) | |
tree | f55a96d3340f7051468280b8885f676e2c5f7ecd | |
parent | 148a60b0757d3c741681a68c86b665ea026a127a (diff) |
Add a test that forbids merge commits
-rw-r--r-- | .github/workflows/ci.yaml | 3 | ||||
-rw-r--r-- | xtask/tests/tidy.rs | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fb077e28d..fa276e2bf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml | |||
@@ -30,6 +30,9 @@ jobs: | |||
30 | steps: | 30 | steps: |
31 | - name: Checkout repository | 31 | - name: Checkout repository |
32 | uses: actions/checkout@v2 | 32 | uses: actions/checkout@v2 |
33 | with: | ||
34 | ref: ${{ github.event.pull_request.head.sha }} | ||
35 | fetch-depth: 5 | ||
33 | 36 | ||
34 | # We need to disable the existing toolchain to avoid updating rust-docs | 37 | # We need to disable the existing toolchain to avoid updating rust-docs |
35 | # which takes a long time. The fastest way to do this is to rename the | 38 | # which takes a long time. The fastest way to do this is to rename the |
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index fd9645c23..c276b6307 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs | |||
@@ -50,6 +50,20 @@ fn rust_files_are_tidy() { | |||
50 | tidy_docs.finish(); | 50 | tidy_docs.finish(); |
51 | } | 51 | } |
52 | 52 | ||
53 | #[test] | ||
54 | fn check_merge_commits() { | ||
55 | let cmd_output = | ||
56 | run!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~4.."; echo = false); | ||
57 | match cmd_output { | ||
58 | Ok(out) => { | ||
59 | if !out.is_empty() { | ||
60 | panic!("Please rebase your branch on top of master by running `git rebase master`"); | ||
61 | } | ||
62 | } | ||
63 | Err(e) => panic!("{}", e), | ||
64 | } | ||
65 | } | ||
66 | |||
53 | fn deny_clippy(path: &PathBuf, text: &String) { | 67 | fn deny_clippy(path: &PathBuf, text: &String) { |
54 | if text.contains("[\u{61}llow(clippy") { | 68 | if text.contains("[\u{61}llow(clippy") { |
55 | panic!( | 69 | panic!( |