-
Notifications
You must be signed in to change notification settings - Fork 196
51 lines (51 loc) · 1.42 KB
/
code-formatting.yml
File metadata and controls
51 lines (51 loc) · 1.42 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
---
name: Code Formatting
on:
push:
branches:
- 'master'
merge_group:
pull_request:
branches:
- '*'
workflow_dispatch:
concurrency:
group: code-formatting-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
code-formatting:
runs-on: ubuntu-24.04
name: Code Formatting
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch base ref
if: ${{ github.event.pull_request }}
run: git fetch origin ${{ github.base_ref }}:upstream
- name: Install Carton
uses: perl-actions/install-with-cpm@v1
with:
install: Carton
- name: Install CPAN deps
uses: perl-actions/install-with-cpm@v1
with:
cpanfile: 'cpanfile'
args: >
--resolver=snapshot
--with-develop
- name: Install precious
run: ./bin/install-precious /usr/local/bin
env:
GITHUB_TOKEN: ${{ github.token }}
- run: perltidy --version
- name: Select files
id: select-files
run: |
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
echo 'precious-args=--git-diff-from upstream' >> "$GITHUB_OUTPUT"
else
echo 'precious-args=--all' >> "$GITHUB_OUTPUT"
fi
- name: Lint files
run: precious lint ${{ steps.select-files.outputs.precious-args }}