Skip to content

Commit 7e5193c

Browse files
committed
Reenable workflow. Fix branch names. Print commit and branch.
1 parent 517402f commit 7e5193c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/workflows/o2-linter.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Find issues in O2 code
33
name: O2 linter
44

5-
#"on": [pull_request_target, push]
5+
"on": [pull_request_target, push]
66
permissions: {}
77
env:
88
BRANCH_MAIN: master
@@ -20,12 +20,12 @@ jobs:
2020
steps:
2121
- name: Set branches
2222
run: |
23-
if [[ "${{ github.event_name }}" == "push" ]]; then
23+
if [[ "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "pull_request" ]]; then
2424
branch_head="${{ github.ref }}"
25-
branch_base="${{ env.BRANCH_MAIN }}"
25+
branch_base="origin/${{ env.BRANCH_MAIN }}"
2626
else
2727
branch_head="refs/pull/${{ github.event.pull_request.number }}/merge"
28-
branch_base="${{ github.event.pull_request.base.ref }}"
28+
branch_base="origin/${{ github.event.pull_request.base.ref }}"
2929
fi
3030
echo BRANCH_HEAD="$branch_head" >> "$GITHUB_ENV"
3131
echo BRANCH_BASE="$branch_base" >> "$GITHUB_ENV"
@@ -37,9 +37,10 @@ jobs:
3737
- name: Run tests
3838
id: linter
3939
run: |
40+
git log -n 1 --pretty='format:%ci %h %s %d%n'
4041
# Diff against the common ancestor of the source (head) branch and the target (base) branch.
4142
echo "Diffing ${{ env.BRANCH_HEAD }} against ${{ env.BRANCH_BASE }}."
42-
readarray -t files < <(git diff --diff-filter d --name-only origin/${{ env.BRANCH_BASE }}...)
43+
readarray -t files < <(git diff --diff-filter d --name-only ${{ env.BRANCH_BASE }}...)
4344
if [ ${#files[@]} -eq 0 ]; then
4445
echo "::notice::No files to lint."
4546
echo "linter_ran=0" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)