-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (63 loc) · 2.55 KB
/
pr-validate-features-files.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Validate feature catalog files
on:
workflow_call:
inputs:
aws_services_path:
description: 'Directory containing AWS service implementations in the localstack repository'
type: string
required: true
pr_number:
description: 'Pull request number for workflow execution'
type: string
required: false
localstack_meta_ref:
description: 'Branch to checkout in the localstack/meta repository without "origin/" prefix'
type: string
required: false
jobs:
validate-features-files:
name: Validate feature catalog files
runs-on: ubuntu-latest
steps:
# Clone repository that's calling this reusable workflow
- name: Checkout current repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
# Clone the localstack/meta repo to access required Python scripts and JSON schema files
- name: Checkout localstack/meta repository
uses: actions/checkout@v4
with:
repository: 'localstack/meta'
sparse-checkout: |
.github/scripts
.github/features_schema.json
ref: ${{ inputs.localstack_meta_ref || 'main' }}
path: 'localstack-meta'
- name: Fetch list of modified files in the PR
id: changed-files
env:
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
run: |
ALL_CHANGED_FILES=$(curl -s -H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/files" | jq -r '.[].filename' | paste -sd, -)
echo "all_changed_files=$ALL_CHANGED_FILES" >> $GITHUB_OUTPUT
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m pip install pyyaml jsonschema
- name: Check features files exist
env:
ALL_CHANGED_FILES: "${{ steps.changed-files.outputs.all_changed_files }}"
SERVICES_PATH: "${{ inputs.aws_services_path }}"
run: python3 localstack-meta/.github/scripts/check_features_files_exist.py
- name: Validate features files
env:
ALL_CHANGED_FILES: "${{ steps.changed-files.outputs.all_changed_files }}"
FEATURES_JSON_SCHEMA: 'localstack-meta/.github/features_schema.json'
run: python3 localstack-meta/.github/scripts/validate_features_files.py