amati 0.3.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. amati-0.3.14/.dockerignore +1 -0
  2. amati-0.3.14/.github/actions/setup/action.yaml +19 -0
  3. amati-0.3.14/.github/dependabot.yml +24 -0
  4. amati-0.3.14/.github/workflows/checks.yaml +90 -0
  5. amati-0.3.14/.github/workflows/codeql.yml +106 -0
  6. amati-0.3.14/.github/workflows/coverage.yaml +33 -0
  7. amati-0.3.14/.github/workflows/data-refresh.yaml +196 -0
  8. amati-0.3.14/.github/workflows/dependency-review.yml +27 -0
  9. amati-0.3.14/.github/workflows/publish.yaml +60 -0
  10. amati-0.3.14/.github/workflows/scorecards.yml +85 -0
  11. amati-0.3.14/.github/workflows/tag-and-create-release.yaml +78 -0
  12. amati-0.3.14/.gitignore +142 -0
  13. amati-0.3.14/.pre-commit-config.yaml +19 -0
  14. amati-0.3.14/.python-version +1 -0
  15. amati-0.3.14/Dockerfile +18 -0
  16. amati-0.3.14/LICENSE +21 -0
  17. amati-0.3.14/PKG-INFO +164 -0
  18. amati-0.3.14/README.md +130 -0
  19. amati-0.3.14/SECURITY.md +15 -0
  20. amati-0.3.14/TEMPLATE.html +116 -0
  21. amati-0.3.14/amati/__init__.py +17 -0
  22. amati-0.3.14/amati/_data/files/http-status-codes.json +502 -0
  23. amati-0.3.14/amati/_data/files/iso9110.json +72 -0
  24. amati-0.3.14/amati/_data/files/media-types.json +2257 -0
  25. amati-0.3.14/amati/_data/files/schemes.json +406 -0
  26. amati-0.3.14/amati/_data/files/spdx-licences.json +8281 -0
  27. amati-0.3.14/amati/_data/files/tlds.json +1595 -0
  28. amati-0.3.14/amati/_data/http_status_code.py +32 -0
  29. amati-0.3.14/amati/_data/iso9110.py +25 -0
  30. amati-0.3.14/amati/_data/media_types.py +42 -0
  31. amati-0.3.14/amati/_data/refresh.py +171 -0
  32. amati-0.3.14/amati/_data/schemes.py +23 -0
  33. amati-0.3.14/amati/_data/spdx_licences.py +23 -0
  34. amati-0.3.14/amati/_data/tlds.py +23 -0
  35. amati-0.3.14/amati/_error_handler.py +48 -0
  36. amati-0.3.14/amati/_logging.py +57 -0
  37. amati-0.3.14/amati/_resolve_forward_references.py +183 -0
  38. amati-0.3.14/amati/amati.py +273 -0
  39. amati-0.3.14/amati/exceptions.py +22 -0
  40. amati-0.3.14/amati/fields/__init__.py +15 -0
  41. amati-0.3.14/amati/fields/_custom_types.py +71 -0
  42. amati-0.3.14/amati/fields/commonmark.py +9 -0
  43. amati-0.3.14/amati/fields/email.py +40 -0
  44. amati-0.3.14/amati/fields/http_status_codes.py +88 -0
  45. amati-0.3.14/amati/fields/iso9110.py +55 -0
  46. amati-0.3.14/amati/fields/json.py +13 -0
  47. amati-0.3.14/amati/fields/media.py +91 -0
  48. amati-0.3.14/amati/fields/oas.py +73 -0
  49. amati-0.3.14/amati/fields/spdx_licences.py +82 -0
  50. amati-0.3.14/amati/fields/uri.py +340 -0
  51. amati-0.3.14/amati/file_handler.py +264 -0
  52. amati-0.3.14/amati/grammars/oas.py +45 -0
  53. amati-0.3.14/amati/grammars/rfc6901.py +24 -0
  54. amati-0.3.14/amati/grammars/rfc7159.py +63 -0
  55. amati-0.3.14/amati/model_validators.py +446 -0
  56. amati-0.3.14/amati/py.typed +0 -0
  57. amati-0.3.14/amati/validators/__init__.py +0 -0
  58. amati-0.3.14/amati/validators/generic.py +154 -0
  59. amati-0.3.14/amati/validators/oas304.py +984 -0
  60. amati-0.3.14/amati/validators/oas311.py +514 -0
  61. amati-0.3.14/bin/checks.sh +11 -0
  62. amati-0.3.14/bin/startup.sh +5 -0
  63. amati-0.3.14/bin/upgrade-python.sh +16 -0
  64. amati-0.3.14/bin/uv-upgrade-from-main.sh +12 -0
  65. amati-0.3.14/pyproject.toml +143 -0
  66. amati-0.3.14/scripts/setup_test_specs.py +103 -0
  67. amati-0.3.14/tests/__init__.py +0 -0
  68. amati-0.3.14/tests/data/.amati.tests.yaml +99 -0
  69. amati-0.3.14/tests/data/DigitalOcean-public.v2.errors.json +15 -0
  70. amati-0.3.14/tests/data/api.github.com.yaml.errors.json +23 -0
  71. amati-0.3.14/tests/data/discourse.yml.errors.json +1 -0
  72. amati-0.3.14/tests/data/invalid-openapi.yaml +26 -0
  73. amati-0.3.14/tests/data/next-api.github.com.yaml.errors.json +32 -0
  74. amati-0.3.14/tests/data/openapi.yaml +26 -0
  75. amati-0.3.14/tests/data/openapi.yaml.gz +0 -0
  76. amati-0.3.14/tests/data/redocly.openapi.yaml.errors.json +23 -0
  77. amati-0.3.14/tests/fields/__init__.py +0 -0
  78. amati-0.3.14/tests/fields/test_email.py +40 -0
  79. amati-0.3.14/tests/fields/test_http_status_codes.py +56 -0
  80. amati-0.3.14/tests/fields/test_iso9110.py +38 -0
  81. amati-0.3.14/tests/fields/test_media.py +83 -0
  82. amati-0.3.14/tests/fields/test_oas.py +103 -0
  83. amati-0.3.14/tests/fields/test_spdx_licences.py +44 -0
  84. amati-0.3.14/tests/fields/test_uri.py +239 -0
  85. amati-0.3.14/tests/helpers.py +51 -0
  86. amati-0.3.14/tests/model_validators/test_all_of.py +202 -0
  87. amati-0.3.14/tests/model_validators/test_at_least_one.py +269 -0
  88. amati-0.3.14/tests/model_validators/test_if_then.py +363 -0
  89. amati-0.3.14/tests/model_validators/test_only_one.py +192 -0
  90. amati-0.3.14/tests/test_amati.py +87 -0
  91. amati-0.3.14/tests/test_external_specs.py +89 -0
  92. amati-0.3.14/tests/test_logging.py +31 -0
  93. amati-0.3.14/tests/validators/__init__.py +0 -0
  94. amati-0.3.14/tests/validators/test_generic.py +101 -0
  95. amati-0.3.14/tests/validators/test_licence_object.py +158 -0
  96. amati-0.3.14/tests/validators/test_security_scheme_object.py +306 -0
  97. amati-0.3.14/tests/validators/test_server_variable_object.py +49 -0
  98. amati-0.3.14/uv.lock +687 -0
@@ -0,0 +1 @@
1
+ .venv
@@ -0,0 +1,19 @@
1
+ name: 'Setup Python Project'
2
+ description: 'Setup Python with uv and install dependencies'
3
+
4
+ runs:
5
+ using: "composite"
6
+ steps:
7
+ - name: Install uv
8
+ uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
9
+ with:
10
+ enable-cache: true # Keep it - doesn't hurt, might help occasionally
11
+
12
+ - name: Set up Python
13
+ uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
14
+ with:
15
+ python-version-file: ".python-version"
16
+
17
+ - name: Install the project
18
+ shell: bash
19
+ run: uv sync --locked --all-extras --dev
@@ -0,0 +1,24 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "uv"
4
+ # Look for `uv.lock` file in the root directory.
5
+ directory: "/"
6
+ # Check the registry for updates every day (weekdays)
7
+ schedule:
8
+ interval: "daily"
9
+
10
+ - package-ecosystem: "github-actions"
11
+ # Workflow files stored in the default location of `.github/workflows`
12
+ # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
13
+ directory: "/"
14
+ schedule:
15
+ interval: "weekly"
16
+ allow:
17
+ - dependency-type: "direct"
18
+ - dependency-type: "indirect"
19
+
20
+ - package-ecosystem: "docker"
21
+ # Look for `Dockerfile` in the root directory
22
+ directory: "/"
23
+ schedule:
24
+ interval: "weekly"
@@ -0,0 +1,90 @@
1
+ name: Checks
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [ "main" ]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ pull-requests: write
15
+ contents: write
16
+ actions: read
17
+ steps:
18
+ - name: Harden the runner (Audit all outbound calls)
19
+ uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
20
+ with:
21
+ egress-policy: audit
22
+
23
+ - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
24
+
25
+ - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
26
+ id: check_changes
27
+ with:
28
+ filters: |
29
+ relevant:
30
+ - '**/*.py'
31
+ - '**/*.sh'
32
+ - '**/*.json'
33
+ - '**/*.html'
34
+ - '**/*.toml'
35
+ - '**/*.lock'
36
+ - 'tests/**/*.yaml'
37
+ - '.python-version'
38
+ - '.Dockerfile'
39
+
40
+ - name: Skip message
41
+ if: ${{ !(steps.check_changes.outputs.relevant == 'true') }}
42
+ run: echo "Skipping Python checks - no relevant changes detected"
43
+
44
+
45
+ - name: Setup project
46
+ if: steps.check_changes.outputs.relevant == 'true'
47
+ uses: ./.github/actions/setup
48
+
49
+ - name: Run linting
50
+ if: steps.check_changes.outputs.relevant == 'true'
51
+ uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
52
+ with:
53
+ args: check --fix
54
+
55
+ - name: Run formatting
56
+ if: steps.check_changes.outputs.relevant == 'true'
57
+ uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
58
+ with:
59
+ args: format
60
+
61
+ - name: Type checking
62
+ if: steps.check_changes.outputs.relevant == 'true'
63
+ uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e
64
+ with:
65
+ project: pyproject.toml
66
+ python-path: .venv/bin/python
67
+ extra-args: amati
68
+
69
+ - name: Testing
70
+ if: steps.check_changes.outputs.relevant == 'true'
71
+ run: uv run pytest -m"not external" --cov
72
+
73
+ - name: Doctests
74
+ if: steps.check_changes.outputs.relevant == 'true'
75
+ run: uv run pytest --doctest-modules amati/
76
+
77
+ - name: Coverage comment
78
+ if: steps.check_changes.outputs.relevant == 'true'
79
+ id: coverage_comment
80
+ uses: py-cov-action/python-coverage-comment-action@14efb884fd6f322dca843a946ce2125a55c12e1d # v3
81
+ with:
82
+ GITHUB_TOKEN: ${{ secrets.BOT_COMMENT_TOKEN }}
83
+ continue-on-error: true
84
+
85
+ - name: Store Pull Request comment to be posted
86
+ if: steps.check_changes.outputs.relevant == 'true'
87
+ uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
88
+ with:
89
+ name: python-coverage-comment-action
90
+ path: python-coverage-comment-action.txt
@@ -0,0 +1,106 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL Advanced"
13
+
14
+ on:
15
+ pull_request:
16
+ branches: [ "main" ]
17
+ schedule:
18
+ - cron: '0 0 * * 1,4'
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze (${{ matrix.language }})
26
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
27
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
28
+ # - https://gh.io/supported-runners-and-hardware-resources
29
+ # - https://gh.io/using-larger-runners (GitHub.com only)
30
+ # Consider using larger runners or machines with greater resources for possible analysis time improvements.
31
+ runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
32
+ permissions:
33
+ # required for all workflows
34
+ security-events: write
35
+
36
+ # required to fetch internal or private CodeQL packs
37
+ packages: read
38
+
39
+ # only required for workflows in private repositories
40
+ actions: read
41
+ contents: read
42
+
43
+ strategy:
44
+ fail-fast: false
45
+ matrix:
46
+ include:
47
+ - language: actions
48
+ build-mode: none
49
+ - language: python
50
+ build-mode: none
51
+ # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
52
+ # Use `c-cpp` to analyze code written in C, C++ or both
53
+ # Use 'java-kotlin' to analyze code written in Java, Kotlin or both
54
+ # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
55
+ # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
56
+ # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
57
+ # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
58
+ # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
59
+ steps:
60
+ - name: Harden the runner (Audit all outbound calls)
61
+ uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
62
+ with:
63
+ egress-policy: audit
64
+
65
+ - name: Checkout repository
66
+ uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
67
+
68
+ # Add any setup steps before running the `github/codeql-action/init` action.
69
+ # This includes steps like installing compilers or runtimes (`actions/setup-node`
70
+ # or others). This is typically only required for manual builds.
71
+ # - name: Setup runtime (example)
72
+ # uses: actions/setup-example@v1
73
+
74
+ # Initializes the CodeQL tools for scanning.
75
+ - name: Initialize CodeQL
76
+ uses: github/codeql-action/init@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
77
+ with:
78
+ languages: ${{ matrix.language }}
79
+ build-mode: ${{ matrix.build-mode }}
80
+ # If you wish to specify custom queries, you can do so here or in a config file.
81
+ # By default, queries listed here will override any specified in a config file.
82
+ # Prefix the list here with "+" to use these queries and those in the config file.
83
+
84
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
85
+ # queries: security-extended,security-and-quality
86
+
87
+ # If the analyze step fails for one of the languages you are analyzing with
88
+ # "We were unable to automatically build your code", modify the matrix above
89
+ # to set the build mode to "manual" for that language. Then modify this step
90
+ # to build your code.
91
+ # ℹ️ Command-line programs to run using the OS shell.
92
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
93
+ - if: matrix.build-mode == 'manual'
94
+ shell: bash
95
+ run: |
96
+ echo 'If you are using a "manual" build mode for one or more of the' \
97
+ 'languages you are analyzing, replace this with the commands to build' \
98
+ 'your code, for example:'
99
+ echo ' make bootstrap'
100
+ echo ' make release'
101
+ exit 1
102
+
103
+ - name: Perform CodeQL Analysis
104
+ uses: github/codeql-action/analyze@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
105
+ with:
106
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,33 @@
1
+ # .github/workflows/coverage.yml
2
+ name: Post coverage comment
3
+
4
+ on:
5
+ workflow_run:
6
+ workflows: ["Checks"]
7
+ types:
8
+ - completed
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ test:
15
+ name: Run tests & display coverage
16
+ runs-on: ubuntu-latest
17
+ if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
18
+ steps:
19
+ # DO NOT run actions/checkout here, for security reasons
20
+ # For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
21
+ - name: Harden the runner (Audit all outbound calls)
22
+ uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
23
+ with:
24
+ egress-policy: audit
25
+
26
+ - name: Post comment
27
+ uses: py-cov-action/python-coverage-comment-action@14efb884fd6f322dca843a946ce2125a55c12e1d # v3
28
+ with:
29
+ GITHUB_TOKEN: ${{ secrets.BOT_COMMENT_TOKEN }}
30
+ GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
31
+ # Update those if you changed the default values:
32
+ # COMMENT_ARTIFACT_NAME: python-coverage-comment-action
33
+ # COMMENT_FILENAME: python-coverage-comment-action.txt
@@ -0,0 +1,196 @@
1
+ name: Data Refresh
2
+
3
+ on:
4
+ schedule:
5
+ # Run every Sunday at 2 AM UTC
6
+ - cron: '0 2 * * 0'
7
+ workflow_dispatch: # Allow manual triggering
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ refresh-data:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: Harden the runner (Audit all outbound calls)
18
+ uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
19
+ with:
20
+ egress-policy: audit
21
+
22
+ - name: Checkout repository
23
+ uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
24
+ with:
25
+ token: ${{ secrets.BOT_TOKEN }}
26
+
27
+ - name: Set up uv
28
+ uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
29
+ with:
30
+ version: "latest"
31
+
32
+ - name: Set up Python using .python-version
33
+ run: uv python install
34
+
35
+ - name: Install dependencies
36
+ run: uv sync
37
+
38
+ - name: Configure Git
39
+ run: |
40
+ git config --local user.email "218805929+amati-bot@users.noreply.github.com"
41
+ git config --local user.name "amati[bot]"
42
+
43
+ - name: Create and switch to new branch
44
+ run: |
45
+ BRANCH_NAME="data-refresh-$(date +%Y%m%d-%H%M%S)"
46
+ echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
47
+ git checkout -b $BRANCH_NAME
48
+
49
+ - name: Run data refresh script
50
+ id: run_script
51
+ run: |
52
+ # Capture both stdout and exit code
53
+ set +e
54
+ OUTPUT=$(uv run python amati/amati.py refresh 2>&1)
55
+ EXIT_CODE=$?
56
+ set -e
57
+
58
+ # Save output for potential use in issue creation
59
+ echo "SCRIPT_OUTPUT<<EOF" >> $GITHUB_ENV
60
+ echo "$OUTPUT" >> $GITHUB_ENV
61
+ echo "EOF" >> $GITHUB_ENV
62
+
63
+ echo "script_exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
64
+
65
+ # Print the output for workflow logs
66
+ echo "$OUTPUT"
67
+
68
+ # Exit with the same code as the script
69
+ exit $EXIT_CODE
70
+
71
+ - name: Check for changes
72
+ id: check_changes
73
+ if: steps.run_script.outputs.script_exit_code == '0'
74
+ run: |
75
+ if git diff --quiet && git diff --cached --quiet; then
76
+ echo "changes=false" >> $GITHUB_OUTPUT
77
+ echo "No changes detected"
78
+ else
79
+ echo "changes=true" >> $GITHUB_OUTPUT
80
+ echo "Changes detected:"
81
+ git status
82
+ echo ""
83
+ echo "Files changed:"
84
+ git diff --name-only
85
+ git diff --cached --name-only
86
+ fi
87
+
88
+ - name: Delete branch if no changes
89
+ if: steps.run_script.outputs.script_exit_code == '0' && steps.check_changes.outputs.changes == 'false'
90
+ run: |
91
+ echo "No changes detected. Cleaning up branch."
92
+ git checkout main
93
+ git branch -D $BRANCH_NAME
94
+
95
+ - name: Commit and push changes
96
+ if: steps.run_script.outputs.script_exit_code == '0' && steps.check_changes.outputs.changes == 'true'
97
+ run: |
98
+ git add .
99
+ git commit -m "refresh data - automated update
100
+
101
+ This commit contains automated data refresh changes.
102
+ Generated on: $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
103
+ git push origin $BRANCH_NAME
104
+
105
+ - name: Create Pull Request
106
+ if: steps.run_script.outputs.script_exit_code == '0' && steps.check_changes.outputs.changes == 'true'
107
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
108
+ with:
109
+ github-token: ${{ secrets.BOT_TOKEN }}
110
+ script: |
111
+ const { data: pullRequest } = await github.rest.pulls.create({
112
+ owner: context.repo.owner,
113
+ repo: context.repo.repo,
114
+ title: `Automated data refresh`,
115
+ head: process.env.BRANCH_NAME,
116
+ base: 'main',
117
+ body: `## Automated Data Refresh
118
+
119
+ This PR contains automated data refresh changes generated by the weekly data refresh workflow.
120
+
121
+ ### Changes
122
+ - Data refreshed using \`python amati/amati.py refresh\`
123
+ - Files updated in \`amati/_data/files/\` directory
124
+
125
+ ### Details
126
+ - **Generated on:** ${new Date().toISOString()}
127
+ - **Branch:** ${process.env.BRANCH_NAME}
128
+ - **Workflow:** Weekly Data Refresh
129
+
130
+ This PR was created automatically. Please review the changes before merging.`
131
+ });
132
+
133
+ // Add the data-update label
134
+ await github.rest.issues.addLabels({
135
+ owner: context.repo.owner,
136
+ repo: context.repo.repo,
137
+ issue_number: pullRequest.number,
138
+ labels: ['data-update']
139
+ });
140
+
141
+ console.log(`Created PR #${pullRequest.number}: ${pullRequest.html_url}`);
142
+
143
+ - name: Clean up branch on script failure
144
+ if: failure() && steps.run_script.outputs.script_exit_code != '0'
145
+ run: |
146
+ echo "Script failed. Cleaning up branch."
147
+ git checkout main
148
+ git branch -D $BRANCH_NAME || true
149
+
150
+ - name: Create issue on script failure
151
+ if: failure() && steps.run_script.outputs.script_exit_code != '0'
152
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
153
+ with:
154
+ github-token: ${{ secrets.BOT_TOKEN }}
155
+ script: |
156
+ const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
157
+
158
+ await github.rest.issues.create({
159
+ owner: context.repo.owner,
160
+ repo: context.repo.repo,
161
+ title: `Data refresh script failed - ${new Date().toISOString().split('T')[0]}`,
162
+ body: `## Data Refresh Script Failure
163
+
164
+ The automated data refresh script failed during execution.
165
+
166
+ ### Workflow Details
167
+ - **Workflow Run:** [View workflow run](${workflowUrl})
168
+ - **Failed on:** ${new Date().toISOString()}
169
+ - **Branch:** ${process.env.BRANCH_NAME}
170
+
171
+ ### Script Output
172
+ \`\`\`
173
+ ${process.env.SCRIPT_OUTPUT}
174
+ \`\`\`
175
+
176
+ Please investigate the failure and run the workflow again once the issue is resolved.`,
177
+ labels: ['bug', 'data-update']
178
+ });
179
+
180
+ - name: Summary
181
+ if: always()
182
+ run: |
183
+ if [ "${{ steps.run_script.outputs.script_exit_code }}" != "0" ]; then
184
+ echo "❌ Data refresh script failed"
185
+ echo "🐛 Issue created for investigation"
186
+ elif [ "${{ steps.check_changes.outputs.changes }}" == "true" ]; then
187
+ echo "✅ Data refresh completed successfully!"
188
+ echo "📋 Summary:"
189
+ echo " - Branch created: $BRANCH_NAME"
190
+ echo " - Changes detected and committed"
191
+ echo " - Pull request created with 'data-update' label"
192
+ elif [ "${{ steps.check_changes.outputs.changes }}" == "false" ]; then
193
+ echo "ℹ️ No changes detected - branch cleaned up"
194
+ else
195
+ echo "⚠️ Workflow completed with unknown state"
196
+ fi
@@ -0,0 +1,27 @@
1
+ # Dependency Review Action
2
+ #
3
+ # This Action will scan dependency manifest files that change as part of a Pull Request,
4
+ # surfacing known-vulnerable versions of the packages declared or updated in the PR.
5
+ # Once installed, if the workflow run is marked as required,
6
+ # PRs introducing known-vulnerable packages will be blocked from merging.
7
+ #
8
+ # Source repository: https://github.com/actions/dependency-review-action
9
+ name: 'Dependency Review'
10
+ on: [pull_request]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ dependency-review:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Harden the runner (Audit all outbound calls)
20
+ uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
21
+ with:
22
+ egress-policy: audit
23
+
24
+ - name: 'Checkout Repository'
25
+ uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
26
+ - name: 'Dependency Review'
27
+ uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
@@ -0,0 +1,60 @@
1
+ name: Publish to PyPI and Docker
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ run:
13
+ name: "Build and publish release"
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ id-token: write # Required for OIDC authentication
17
+ contents: read
18
+
19
+ steps:
20
+ - name: Harden the runner (Audit all outbound calls)
21
+ uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
22
+ with:
23
+ egress-policy: audit
24
+
25
+ - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
28
+ - name: Set up Python
29
+ uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
30
+ with:
31
+ python-version-file: ".python-version"
32
+ - name: Build
33
+ run: uv build
34
+ - name: Publish to PyPI test
35
+ run: uv publish --index testpypi
36
+ - name: Publish
37
+ run: uv publish
38
+
39
+ - name: Log in to Docker Hub
40
+ uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
41
+ with:
42
+ username: ${{ secrets.DOCKERHUB_USER }}
43
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
44
+
45
+ - name: Set up QEMU
46
+ uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
47
+
48
+ - name: Set up Docker Buildx
49
+ uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
50
+
51
+ - name: Build and push Docker image
52
+ uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
53
+ with:
54
+ context: .
55
+ push: true
56
+ platforms: linux/amd64,linux/arm64
57
+ tags: ${{ secrets.DOCKERHUB_USER }}/${{ secrets.DOCKERHUB_REPO }}:alpha
58
+ #tags: |
59
+ # ${{ secrets.DOCKERHUB_USER }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.event.release.tag_name }}.1
60
+ # ${{ secrets.DOCKERHUB_USER }}/${{ secrets.DOCKERHUB_REPO }}:alpha
@@ -0,0 +1,85 @@
1
+ # This workflow uses actions that are not certified by GitHub. They are provided
2
+ # by a third-party and are governed by separate terms of service, privacy
3
+ # policy, and support documentation.
4
+
5
+ name: Scorecard supply-chain security
6
+ on:
7
+ # For Branch-Protection check. Only the default branch is supported. See
8
+ # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9
+ branch_protection_rule:
10
+ # To guarantee Maintained check is occasionally updated. See
11
+ # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12
+ schedule:
13
+ - cron: '20 7 * * 2'
14
+ push:
15
+ branches: ["main"]
16
+ paths-ignore:
17
+ - 'pyproject.toml'
18
+ - 'uv.lock'
19
+
20
+
21
+ # Declare default permissions as read only.
22
+ permissions: read-all
23
+
24
+ jobs:
25
+ analysis:
26
+ name: Scorecard analysis
27
+ runs-on: ubuntu-latest
28
+ permissions:
29
+ # Needed to upload the results to code-scanning dashboard.
30
+ security-events: write
31
+ # Needed to publish results and get a badge (see publish_results below).
32
+ id-token: write
33
+ contents: read
34
+ actions: read
35
+ # To allow GraphQL ListCommits to work
36
+ issues: read
37
+ pull-requests: read
38
+ # To detect SAST tools
39
+ checks: read
40
+
41
+ steps:
42
+ - name: Harden the runner (Audit all outbound calls)
43
+ uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
44
+ with:
45
+ egress-policy: audit
46
+
47
+ - name: "Checkout code"
48
+ uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
49
+ with:
50
+ persist-credentials: false
51
+
52
+ - name: "Run analysis"
53
+ uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
54
+ with:
55
+ results_file: results.sarif
56
+ results_format: sarif
57
+ # (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
58
+ # - you want to enable the Branch-Protection check on a *public* repository, or
59
+ # - you are installing Scorecards on a *private* repository
60
+ # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
61
+ # repo_token: ${{ secrets.SCORECARD_TOKEN }}
62
+
63
+ # Public repositories:
64
+ # - Publish results to OpenSSF REST API for easy access by consumers
65
+ # - Allows the repository to include the Scorecard badge.
66
+ # - See https://github.com/ossf/scorecard-action#publishing-results.
67
+ # For private repositories:
68
+ # - `publish_results` will always be set to `false`, regardless
69
+ # of the value entered here.
70
+ publish_results: true
71
+
72
+ # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
73
+ # format to the repository Actions tab.
74
+ - name: "Upload artifact"
75
+ uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
76
+ with:
77
+ name: SARIF file
78
+ path: results.sarif
79
+ retention-days: 5
80
+
81
+ # Upload the results to GitHub's code scanning dashboard.
82
+ - name: "Upload to code-scanning"
83
+ uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
84
+ with:
85
+ sarif_file: results.sarif