Skip to content
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

fix: update reusable workflow input handling #2349

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

ChristopherHX
Copy link
Contributor

@ChristopherHX ChristopherHX commented Jun 3, 2024

Remember My outstanding task here is writing tests Done

Fixes #2344

@ChristopherHX ChristopherHX requested a review from a team as a code owner June 3, 2024 22:26
@ChristopherHX ChristopherHX marked this pull request as draft June 3, 2024 22:27
Copy link
Contributor

github-actions bot commented Jun 3, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 2 0 0.02s
✅ REPOSITORY gitleaks yes no 2.35s
✅ REPOSITORY git_diff yes no 0.01s
✅ REPOSITORY grype yes no 7.34s
✅ REPOSITORY secretlint yes no 1.05s
✅ REPOSITORY trivy-sbom yes no 0.64s
✅ REPOSITORY trufflehog yes no 4.65s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link

codecov bot commented Jun 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.30%. Comparing base (5a80a04) to head (a970b77).
Report is 78 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2349       +/-   ##
===========================================
+ Coverage   61.56%   76.30%   +14.73%     
===========================================
  Files          53       61        +8     
  Lines        9002     7806     -1196     
===========================================
+ Hits         5542     5956      +414     
+ Misses       3020     1295     -1725     
- Partials      440      555      +115     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jun 4, 2024
@ChristopherHX ChristopherHX marked this pull request as ready for review June 4, 2024 18:30

- name: test required number
run: |
echo inputs.number_required=${{ inputs.number_required }}
[[ "${{ inputs.number_required == 1 }}" = "true" ]] || exit 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tojson force string equal, to avoid any possible automatic type conversion

// evaluate using the calling RunContext (outside)
value = rc.caller.runContext.ExprEval.Interpolate(ctx, str)
_ = rc.caller.runContext.ExprEval.EvaluateYamlNode(ctx, &node)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expressions can return boolean and number types for parameters so EvaluateYamlNode can do it better than the typeless Interpolate

Type string `yaml:"type"`
Description string `yaml:"description"`
Required bool `yaml:"required"`
Default yaml.Node `yaml:"default"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preserve the original type

@mergify mergify bot merged commit b917ecc into master Jun 5, 2024
11 checks passed
@mergify mergify bot deleted the update-reusable-workflow-inputs branch June 5, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Boolean inputs in reusable workflows are not proper booleans
2 participants