-
-
Notifications
You must be signed in to change notification settings - Fork 87
29 lines (23 loc) · 959 Bytes
/
pr.yml
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
# Run tests for bash or markdown files modified in this PR.
name: bash / pr
on: pull_request
jobs:
ci:
runs-on: ubuntu-24.04
steps:
- name: Checkout PR
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Install bats-core
run: sudo apt update && sudo apt -y install bats
# bats v1.10.0 -- https://launchpad.net/ubuntu/noble/+source/bats
- name: Run tests for changed/added exercises
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr_endpoint=$(jq -r '"repos/\(.repository.full_name)/pulls/\(.pull_request.number)"' "$GITHUB_EVENT_PATH")
gh api "$pr_endpoint/files" --paginate --jq '
.[] |
select(.status == "added" or .status == "modified" or .status == "renamed") |
select(.filename | match("\\.(sh|bash|bats)$")) |
.filename
' | xargs -r bash .github/scripts/pr