-
Notifications
You must be signed in to change notification settings - Fork 40
46 lines (39 loc) · 1.21 KB
/
ensure-sorted.yml
File metadata and controls
46 lines (39 loc) · 1.21 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
name: Ensure lists are sorted
on:
pull_request:
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
tests:
name: Ensure Sorted Order
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
pull-requests: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.10'
- name: Get changed txt files
id: changed_files
env:
BASE_REF: ${{ github.event.pull_request.base.sha }}
run: |
CHANGED_TXT=$(git diff --name-only "$BASE_REF"...HEAD -- '*.txt' | tr '\n' ' ')
echo "files=$CHANGED_TXT" >> "$GITHUB_OUTPUT"
if [ -z "$CHANGED_TXT" ]; then
echo "No .txt files changed in this PR"
else
echo "Changed .txt files: $CHANGED_TXT"
fi
- name: Check file sort order
if: steps.changed_files.outputs.files != ''
run: |
python ./scripts/sorter.py --check ${{ steps.changed_files.outputs.files }}