checkout icon indicating copy to clipboard operation
checkout copied to clipboard

Add path output

Open caugner opened this issue 1 month ago • 1 comments

Adds an output for path.

Similar to https://github.com/actions/checkout/pull/1180, which added outputs for ref and commit.

Having the checkout path available as an output is especially useful when using the path input, and avoids having to duplicate the path manually.

Example:

 jobs:
   test:
     runs-on: ubuntu-latest
 
     steps:
       - name: Checkout content
         id: content
         uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
         with:
           repository: mdn/content
           path: mdn/content
           persist-credentials: false

       - name: Run fred
-        working-directory: mdn/content
+        working-directory: ${{ steps.content.outputs.path }}
         env:
-          CONTENT_ROOT: ${{ github.workspace }}/mdn/content/files
+          CONTENT_ROOT: ${{ steps.content.outputs.path }}/files
         run: npm start

caugner avatar Dec 08 '25 14:12 caugner

@ericsciple Any chance to get this small tested improvement in one of the next releases? We use this action a lot in MDN workflows, and this output would make our life easier. 🙂

caugner avatar Dec 08 '25 14:12 caugner