Repository navigation
124 lines (116 loc) · 4.78 KB
/
Copy pathpr-modifications.yml
File metadata and controls
124 lines (116 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Check PR Modifications
on:
pull_request:
types: [ opened, reopened, synchronize ]
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
# This ensures that no git merge conflict markers (<<<, ...) are contained
merge_conflict_job:
name: Find merge conflicts
if: >
(github.event.pull_request.head.repo.full_name != github.repository) &&
!(
(github.event.pull_request.user.login == 'dependabot[bot]') || (github.event.pull_request.user.login == 'renovate-bot') ||
(
startsWith(github.event.pull_request.title, '[Bot] ') ||
startsWith(github.event.pull_request.title, 'Bump ') ||
startsWith(github.event.pull_request.title, 'New Crowdin updates') ||
startsWith(github.event.pull_request.title, 'Update Gradle Wrapper from')
)
)
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
show-progress: 'false'
- name: Merge Conflict finder
uses: olivernybroe/action-conflict-finder@1a949ebd954a9eaee58802229ea5f9c69fb93a50 # v4.1
no-force-push:
if: >
(github.event.pull_request.head.repo.full_name != github.repository) &&
!(
(github.event.pull_request.user.login == 'dependabot[bot]') || (github.event.pull_request.user.login == 'renovate-bot') ||
(
startsWith(github.event.pull_request.title, '[Bot] ') ||
startsWith(github.event.pull_request.title, 'Bump ') ||
startsWith(github.event.pull_request.title, 'New Crowdin updates') ||
startsWith(github.event.pull_request.title, 'Update Gradle Wrapper from')
)
)
runs-on: ubuntu-slim
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Check force push
id: force_push_check
run: |
if [[ -z "${{ github.event.before }}" ]]; then
echo "✅ New PR created."
exit 0
fi
# A regular push leaves `before` as an ancestor of the new head;
# a rebase/amend force-push does not. Checking ancestry (instead of
# mere object existence via `git cat-file -e`) is reliable even when
# the orphaned `before` commit is still fetched locally.
if git merge-base --is-ancestor "${{ github.event.before }}" HEAD 2>/dev/null; then
echo "✅ Regular push detected."
exit 0
else
echo "❌ Force push detected"
exit 1
fi
unmodified_submodules:
name: Submodules not modified
if: github.event.pull_request.user.login != 'dependabot[bot]'
runs-on: ubuntu-slim
steps:
# No checkout -> the action uses GitHub's API (which is more reliable for submodule changes due to our submodule settings)
- name: Get all submodule changes
id: changes
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: |
jablib/src/main/abbrv.jabref.org
jablib/src/main/resources/csl-styles
jablib/src/main/resources/csl-locales
- name: Submodules modified
if: steps.changes.outputs.any_changed == 'true'
run: |
echo "❌ Submodule modifications detected"
exit 1
other_than_main:
name: Source branch is other than "main"
if: >
(github.event.pull_request.head.repo.full_name != github.repository) &&
!(
(github.event.pull_request.user.login == 'dependabot[bot]') || (github.event.pull_request.user.login == 'renovate-bot') ||
(
startsWith(github.event.pull_request.title, '[Bot] ') ||
startsWith(github.event.pull_request.title, 'Bump ') ||
startsWith(github.event.pull_request.title, 'New Crowdin updates') ||
startsWith(github.event.pull_request.title, 'Update Gradle Wrapper from')
)
)
runs-on: ubuntu-slim
steps:
- if: github.head_ref == 'main'
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
with:
script: |
core.setFailed('Pull requests should come from a branch other than "main"\n\n👉 Please read [the CONTRIBUTING guide](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md#contributing) carefully again. 👈')
upload-pr-number:
runs-on: ubuntu-slim
steps:
- name: Create pr_number.txt
run: echo "${{ github.event.number }}" > pr_number.txt
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: pr_number
path: pr_number.txt