File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Check pull requests.
2
+
3
+ name : Check pull request
4
+
5
+ # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
6
+ on :
7
+ # Trigger workflow on pull request.
8
+ pull_request :
9
+ # branches: [ ci ]
10
+
11
+ jobs :
12
+ check_pull_request :
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ - name : Fetching base and head commit (pull_request)
18
+ # Source for this step: https://github.com/JensDll/should-run
19
+ if : github.event_name == 'pull_request'
20
+ run : |
21
+ git fetch --no-tags --prune --no-recurse-submodules --depth=$((${{ github.event.pull_request.commits }} + 1)) origin ${{ github.event.pull_request.head.sha }}
22
+ git fetch --no-tags --prune --no-recurse-submodules --depth=10 origin ${{ github.event.pull_request.base.sha }}
23
+ git checkout --progress --force ${{ github.event.pull_request.head.sha }}
24
+
25
+ while [[ -n $(git rev-list shallow ^${{ github.event.pull_request.base.sha }}) ]]
26
+ do
27
+ git fetch --no-tags --prune --no-recurse-submodules --deepen=10 origin ${{ github.event.pull_request.base.sha }}
28
+ done
29
+
30
+ base=$(git rev-list ${{ github.event.pull_request.head.sha }} ^${{ github.event.pull_request.base.sha }} | tail --lines 1 | xargs -I {} git rev-parse {}~1)
31
+
32
+ echo "BASE=$base" >> $GITHUB_ENV
33
+ echo "HEAD=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
34
+ - name : Check for whitespace issues.
35
+ run : git log --check ${{ env.BASE }}...${{ env.HEAD }} | grep "^[^:+]*:[0-9]*:" && false || true
36
+ # TODO: Add more checks here (codespell, ...).
You can’t perform that action at this time.
0 commit comments