API Refs: Fix Composer authentication#3308
Conversation
|
Preview of modified files: no change to preview. |
Summary
|
fatal: 'origin' does not appear to be a git repository
fatal: 'origin' does not appear to be a git repository
| - name: Check if work branch exists | ||
| id: check_work_branch | ||
| if: inputs.force == false |
There was a problem hiding this comment.
I set this check step after the checkout step so remote repo is initialized and origin exists.
When I moved it before the checkout, I had fatal: 'origin' does not appear to be a git repository error. For performance, it could have been nice to have it before checkout but it seems there are many things to reproduce like Git authentication.
There was a problem hiding this comment.
Pull request overview
Updates the API reference generation tooling to avoid Composer authentication prompts during create-project, refreshes the tool README, and extends the api_refs GitHub Action to support configurable base/work branches (plus an optional “force” behavior).
Changes:
- Pass Composer auth via
COMPOSER_AUTHduringcomposer create-projectand reduce shell tracing output. - Update
tools/api_refs/README.mdto reflect PHP + REST refs generation and document GitHub Action usage. - Add
base_branch,work_branch, andforceinputs to.github/workflows/api_refs.yaml, including a work-branch existence guard.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
tools/api_refs/README.md |
Updates usage docs and adds GitHub Action invocation examples for building refs. |
tools/api_refs/api_refs.sh |
Adjusts auth handling for Composer create-project during refs generation. |
.github/workflows/api_refs.yaml |
Adds workflow inputs for controlling base/work branches and guarding against existing branches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hey, Do you know how to execute the following security suggestion in github action @api_refs.yaml?: inputs.base_branch is vulnerable to script injection: values of inputs are provided by whoever triggers the workflow. Change this workflow to not use user-controlled data directly in a run block, for example by assigning this expression to an environment variable.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
create-projectstep.base_branchas a input for test purpose. Tested with success:gh workflow run api_refs.yaml -f version=v5.0.9 -f use_dev_version=false --ref fix-api_refs-tool -f base_branch=fix-api_refs-toolbuilt but nothing new found (run) so no PR.gh workflow run api_refs.yaml -f version=v5.0.10 -f use_dev_version=true --ref fix-api_refs-tool -f base_branch=fix-api_refs-tool(run) opened PR API Refs v5.0.10 #3310Checklist