generated from actions/hello-world-docker-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
302 additions
and
153 deletions.
There are no files selected for viewing
This file contains 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,62 @@ | ||
name: Continuous Integration - Docker | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
- feature/** | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test-docker: | ||
name: Docker Tests | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5001:5000 | ||
|
||
env: | ||
TEST_TAG: localhost:5001/actions/yq-yaml-parser-action:latest | ||
|
||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Docker BuildX | ||
id: setup-buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
install: true | ||
driver-opts: network=host | ||
|
||
- name: Build the Container | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.TEST_TAG }} | ||
|
||
- name: Run the Container | ||
id: run | ||
env: | ||
INPUT_YAML_FILE_PATH: ./yq-test-action.yml | ||
run: | | ||
docker run \ | ||
--workdir /github/workspace \ | ||
--volume "${{ github.workspace }}":/github/workspace \ | ||
--env GITHUB_OUTPUT="/github/workspace/github_output.txt" \ | ||
--env INPUT_YAML_FILE_PATH="${{ env.INPUT_YAML_FILE_PATH }}" \ | ||
--rm ${{ env.TEST_TAG }} | ||
echo "" | ||
echo "Run Output:" | ||
cat ${{ github.workspace }}/github_output.txt |
This file contains 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,100 @@ | ||
name: Continuous Integration - Test Action | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
- feature/** | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test-action: | ||
name: Action Test Output | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
comment-line: ${{ steps.action.outputs.test-action_comment-line }} | ||
to-dont-read: ${{ steps.action.outputs.test-action_to-dont-read }} | ||
multiline: ${{ steps.action.outputs.test-action_multiline }} | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Test Action | ||
id: action | ||
uses: ./ | ||
with: | ||
file-path: ./yq-test-action.yml | ||
filtering-keys: | | ||
test-action_comment-line | ||
test-action_to-rename | ||
test-action_multiline | ||
renaming-outputs: | | ||
test-action_to-rename=test-action_renamed | ||
test-action-output-comment-line: | ||
name: Action Test Output - Comment Line | ||
needs: test-action | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Test Output Comment Line | ||
id: test-output-comment-line | ||
run: | | ||
test_name="Test Output Comment Line" | ||
expected="./app =" | ||
.github/scripts/test-action-output.sh \ | ||
"$test_name" \ | ||
"$expected" \ | ||
"${{ needs.test-action.outputs.comment-line }}" | ||
test-action-output-dont-read: | ||
name: Action Test Output - Don't Read | ||
needs: test-action | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Test Output Don't Read | ||
id: test-output-dont-read | ||
run: | | ||
test_name="Test Output Don't Read" | ||
expected='' | ||
.github/scripts/test-action-output.sh \ | ||
"$test_name" \ | ||
"$expected" \ | ||
"${{ needs.test-action.outputs.to-dont-read }}" | ||
test-action-output-multiline: | ||
name: Action Test Output - Multiline | ||
needs: test-action | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Test Output Multiline | ||
id: test-output-multiline | ||
run: | | ||
test_name="Test Output Multiline" | ||
expected="### Heading\n\n* Bullet C:\\\n* Driver D:\\\\\n* Points" | ||
expected=$(printf '%s' "${expected}" | sed -e 's/\\n/\n/g') | ||
.github/scripts/test-action-output.sh \ | ||
"$test_name" \ | ||
"$expected" \ | ||
"${{ needs.test-action.outputs.multiline }}" |
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
# yq YAML parser action | ||
# YAML parser action | ||
|
||
[![GitHub Super-Linter](https://github.com/actions-betaon/yq-yaml-parser/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter) | ||
![CI](https://github.com/actions-betaon/yq-yaml-parser/actions/workflows/ci.yml/badge.svg) | ||
![CI Docker](https://github.com/actions-betaon/yq-yaml-parser/actions/workflows/ci-docker.yml/badge.svg) | ||
![CI Test](https://github.com/actions-betaon/yq-yaml-parser/actions/workflows/ci-test.yml/badge.svg) | ||
|
||
This action reads values from a YAML file setting as action outputs. | ||
|
||
To learn how this action was built, see [Creating a Docker container action](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action). | ||
|
||
## Usage | ||
|
||
Here's an example of how to use this action in a workflow file: | ||
|
@@ -21,6 +20,14 @@ on: | |
description: "Path to the yaml file to parser" | ||
required: true | ||
type: string | ||
yaml-filtering-keys: | ||
description: "Read using specific keys" | ||
required: false | ||
type: string | ||
yaml-renaming-outputs: | ||
description: "Used to rename the default output name" | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
yq-yaml-parser: | ||
|
@@ -33,13 +40,17 @@ jobs: | |
uses: actions-betaon/[email protected] | ||
with: | ||
file-path: '${{ inputs.yaml-file-path }}' | ||
filtering-keys: '${{ inputs.yaml-filtering-keys }}' | ||
renaming-outputs: '${{ inputs.yaml-renaming-outputs }}' | ||
``` | ||
## Inputs | ||
| Input | Description | Default | | ||
| Input | Description | Required | | ||
| ----------- | ------------------------------- | ----------- | | ||
| `file-path` | Path to the YAML file to parse as output | | | ||
| `file-path` | Path to the YAML file to parse as output | true | | ||
| `filtering-keys` | The YAML key names list to filter as read | false | | ||
| `renaming-outputs` | The YAML rename "keyname=output" output list | false | | ||
|
||
## Outputs | ||
|
||
|
This file contains 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
Oops, something went wrong.