Skip to content

Add workflow to check dependencies on PR review requests#20

Closed
BenjaminLangenakenSF wants to merge 1 commit intomainfrom
add_check_liquid_test_dependencies_workflow_reconciliation_texts
Closed

Add workflow to check dependencies on PR review requests#20
BenjaminLangenakenSF wants to merge 1 commit intomainfrom
add_check_liquid_test_dependencies_workflow_reconciliation_texts

Conversation

@BenjaminLangenakenSF
Copy link
Copy Markdown
Contributor

This workflow checks dependencies for changed reconciliation templates when the 'code-review' label is added to a pull request. It runs the Silverfin CLI command to validate dependencies and posts results as comments.

@BenjaminLangenakenSF BenjaminLangenakenSF self-assigned this Feb 16, 2026
Comment on lines +103 to +107
- name: Setup Node and Silverfin CLI
if: steps.handles.outputs.handles_json != '[]'
run: |
npm install https://github.com/silverfin/silverfin-cli.git
node ./node_modules/silverfin-cli/bin/cli.js -V
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Now each time the node_modules and the cli need to be installed. We could consider to add a caching mechanism so that these actions run a lot faster. That is not specific to this PR

echo "Command: \`silverfin check-dependencies -h ${handle}\`"
echo ""
output=$(node ./node_modules/silverfin-cli/bin/cli.js check-dependencies -h "$handle" 2>&1) || true
exit_code=$?
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The || true on the previous line swallows the real exit code. $? here will always be 0, so job_failed is never set to 1 and the workflow can never fail.

Suggested fix:

output=$(node ./node_modules/silverfin-cli/bin/cli.js check-dependencies -h "$handle" 2>&1) && exit_code=0 || exit_code=$?

'',
'Ran for reconciliation templates changed in this PR (triggered by `code-review` label).',
'',
'${{ steps.run-check.outputs.results }}',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Script injection risk: The CLI output is interpolated directly into JavaScript via ${{ }}. If the output contains a single quote or backtick, it could break the script or execute unintended code.

Safer to pass it via an environment variable:

env:
  RESULTS: ${{ steps.run-check.outputs.results }}
script: |
  const results = process.env.RESULTS;

@BenjaminLangenakenSF BenjaminLangenakenSF deleted the add_check_liquid_test_dependencies_workflow_reconciliation_texts branch March 27, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants