[ci18-7277] Detect the layout in the action, so api-token is the only input - #5
Merged
Merged
Conversation
… input
The on-ramp's whole promise is copy-paste, and it was not being kept. The
input gate rejected a call that carried only api-token, so every snippet the
product printed had to spell out source-locale + patterns — which meant the
user typing a path by hand, or the product guessing one and showing a
placeholder that looked like a detected value.
Meanwhile the machinery to avoid that already existed and shipped: ptc-cli is
vendored inside this action, `ptc init` needs no token (ci18-7276), and the
public detect_config endpoint (ci18-7247 / ci18-7275) answers anonymously.
Nothing was missing except wiring them together here.
Resolution order, first match wins:
1. config-file — an explicit path the caller passed
2. .ptc-config.yml — one committed to the repository
3. source-locale + patterns — the caller spelled it out inline
4. nothing — run `ptc init` right here and use what it writes
So the minimal call is now:
- uses: OnTheGoSystems/ptc-action@v1
with:
api-token: ${{ secrets.PTC_API_TOKEN }}
create-pr: true
A layout the classifier does not recognise still writes a config — a
commented template with no files: block. The action checks for that and
fails with the reason and the way out, rather than letting the CLI stop on a
config it cannot use.
Verified against production with act: the minimal call detects
locales/en.json -> locales/{{lang}}.json, translates to de and ru, and
unpacks both. The explicit-patterns call still skips detection entirely.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
The on-ramp promises copy-paste, and it was not keeping that promise. The input gate rejected a call carrying only
api-token, so every snippet the product printed had to spell outsource-locale+patterns— meaning the user typed a path by hand, or the product guessed one and showed a placeholder that looked like a detected value.The machinery to avoid that already shipped:
ptc-cliis vendored inside this action,ptc initneeds no token (ci18-7276), anddetect_configanswers anonymously (ci18-7247 / ci18-7275). Nothing was missing except wiring them together here.What
Resolution order, first match wins:
config-file— an explicit path the caller passed.ptc-config.yml— one committed to the repositorysource-locale+patterns— spelled out inlineptc initright here and use what it writesMinimal call becomes:
A layout the classifier does not recognise still writes a config — a commented template with no
files:block. The action checks for that and fails with the reason and the way out, instead of letting the CLI stop on a config it cannot use.Verified against production (act)
Minimal call — detection fires and the run completes:
Explicit patterns — detection is skipped entirely, behaviour unchanged. No regression.
Self-test now also asserts the three inputs stay optional and that the action can detect on its own.