-
Notifications
You must be signed in to change notification settings - Fork 1
feat(validate-domain): create action #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
eb88005
feat(ci): add init action
233ad82
feat: add test workflow for validating domain action
2245204
feat: add validation workflow for Helm chart domain annotation
b393c07
Update actions/validate-domain/README.md
michalby24 1f9eb5d
Update .github/workflows/test-validate-domain.yaml
michalby24 ac8bba5
feat: add validate-domain action configuration to release-please
99c62af
fix: update validate-domain action to remove allowed-domains input an…
d086d52
docs: update README to include release-please versioning markers
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: test-validate-domain | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "actions/validate-domain/**" | ||
|
|
||
| jobs: | ||
| validate-domain: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Test validate domain action | ||
| uses: ./actions/validate-domain | ||
| with: | ||
| chart-file: test/helm/Chart.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # validate-domain | ||
|
|
||
| Validate that a Helm chart (`Chart.yaml`) contains an `annotations.domain` value that is one of a configured set of allowed domains. | ||
|
|
||
| ## ✨ What It Does | ||
|
|
||
| The action: | ||
| Checks if the `Chart.yaml` has the "domain" annotation and validates that the domain is in the domains list | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Required | Default | Description | | ||
| |------|----------|---------|-------------| | ||
| | `chart-file` | no | `helm/Chart.yaml` | Path to the Helm chart file whose `annotations.domain` will be validated. | | ||
|
|
||
| The set of allowed domains is constant (not configurable): | ||
|
|
||
| ``` | ||
| raster, vector, infra, 3d, app, dem, common | ||
| ``` | ||
|
|
||
| If you need to change or extend this list, update the action source or open a PR. | ||
|
|
||
|
|
||
| ## 🚀 Usage | ||
|
|
||
| <!-- x-release-please-start-version --> | ||
| ```yaml | ||
| - name: Validate domain | ||
| uses: MapColonies/shared-workflows/actions/validate-domain@v1 | ||
| ``` | ||
| <!-- x-release-please-end-version --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: validate-domain | ||
| description: "Validate that helm/Chart.yaml contains annotations.domain with an allowed value" | ||
|
|
||
| inputs: | ||
| chart-file: | ||
| description: "Path to Chart.yaml" | ||
| required: false | ||
| default: "helm/Chart.yaml" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Read domain annotation from Chart.yaml | ||
| id: get_domain | ||
| uses: mikefarah/yq@v4.48.2 | ||
| with: | ||
| cmd: yq e '.annotations.domain' "${{ inputs.chart-file }}" | ||
|
|
||
| - name: Validate domain | ||
| env: | ||
| ALLOWED_DOMAINS: "raster,vector,infra,3d,app,dem,common" | ||
| shell: bash | ||
| run: | | ||
| DOMAIN="${{ steps.get_domain.outputs.result }}" | ||
| IFS=',' read -ra ALLOWED <<< "${{ env.ALLOWED_DOMAINS }}" | ||
|
|
||
| if ! printf "%s\n" "${ALLOWED[@]}" | grep -qx "$DOMAIN"; then | ||
| echo "Invalid domain: $DOMAIN" | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.