GitHub Action
Expect Self Params
A GitHub Action to validate that specified parameters in your workflow steps are set to expected values. This helps ensure that your workflows are configured correctly and consistently.
- Validation of Step Parameters: Ensures that critical step parameters are correctly set
- Supports Workflow, Job, and Step Levels: Validate parameters at any level in your workflow
- Customizable: Define any parameter and its expected value
- Easy Integration: Simple to use in any GitHub Actions workflow
To use this action, add it as a step in your workflow and specify the parameters to check. Below is an example configuration.
name: Test Expect Self Parameter Action
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run expect-self-params action
uses: Rindrics/expect-self-params@v1
with:
params: >
{
"workflow": {
"on": "[push, pull_request]"
},
"jobs.test": {
"runs-on": "ubuntu-latest"
},
"steps.foo": {
"continue-on-error": "true"
},
"steps.bar": {
"timeout-minutes": "10"
}
}
- id: foo
run: echo hello
continue-on-error: false
- id: bar
run: sleep 5
timeout-minutes: 10
In this example, the action checks if:
- the
on
field of the workflow is set to[push, pull_request]
- the
test
job hasruns-on
set toubuntu-latest
- the
foo
step hascontinue-on-error
set totrue
- the
bar
step hastimeout-minutes
set to10
If the parameters do not match the expected values, the workflow will fail, indicating which parameter was incorrect.
Required The parameters to validate, specified in JSON format. You can check parameters at the workflow, job, or step level.
Example:
{
"workflow": {
"on": "[push, pull_request]"
},
"jobs.test": {
"runs-on": "ubuntu-latest"
},
"steps.foo": {
"continue-on-error": "true"
},
"steps.bar": {
"timeout-minutes": "10"
}
}
None.
This action is particularly useful for GitHub Action developers who want to enforce specific configurations in their workflows. By using this action, you can ensure that users of your action have set the required parameters correctly. This helps prevent misconfigurations and ensures that the action behaves as expected.
For example, if your action requires that a certain step has continue-on-error
set to true
to handle errors gracefully, you can enforce this configuration by including expect-self-parameter
in your workflow.
This project is licensed under the MIT License.