Skip to content

Commit 10cd0b5

Browse files
committed
Try env in jobs scope
1 parent 5059727 commit 10cd0b5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/o2-linter.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ name: O2 linter
44

55
"on": [pull_request_target, push]
66
permissions: {}
7-
env:
8-
HEAD_BRANCH: ${{ github.event_name == 'push' && github.ref || 'refs/pull/'{{ github.event.number }}'/merge' }}
9-
BASE_BRANCH: ${{ github.event_name == 'push' && 'master' || github.event.pull_request.base.ref }}
107

118
concurrency:
129
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
1310
cancel-in-progress: true
1411

1512
jobs:
1613
o2-linter:
14+
env:
15+
branch_head: ${{ github.event_name == 'push' && github.ref || 'refs/pull/'{{ github.event.number }}'/merge' }}
16+
branch_base: ${{ github.event_name == 'push' && 'master' || github.event.pull_request.base.ref }}
1717
name: O2 linter
1818
runs-on: ubuntu-24.04
1919
permissions:
@@ -22,14 +22,14 @@ jobs:
2222
- name: Checkout Code
2323
uses: actions/checkout@v4
2424
with:
25-
ref: ${{ env.HEAD_BRANCH }}
25+
ref: ${{ env.branch_head }}
2626
fetch-depth: 0 # needed to get the full history
2727
- name: Run tests
2828
id: linter
2929
run: |
3030
# Diff against the common ancestor of the source branch and the target branch.
31-
echo "Diffing ${{ env.HEAD_BRANCH }} against ${{ env.BASE_BRANCH }}."
32-
readarray -t files < <(git diff --diff-filter d --name-only origin/${{ env.BASE_BRANCH }}...)
31+
echo "Diffing ${{ env.branch_head }} against ${{ env.branch_base }}."
32+
readarray -t files < <(git diff --diff-filter d --name-only origin/${{ env.branch_base }}...)
3333
if [ ${#files[@]} -eq 0 ]; then
3434
echo "::notice::No files to lint."
3535
echo "linter_ran=0" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)