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

Home directory cannot be accessed via ~ #368

Open
LightTab2 opened this issue Jun 21, 2023 · 3 comments
Open

Home directory cannot be accessed via ~ #368

LightTab2 opened this issue Jun 21, 2023 · 3 comments

Comments

@LightTab2
Copy link

LightTab2 commented Jun 21, 2023

Description:
I think that the home directory cannot be accessed via ~. It does not fail, but cannot find the files that obviously should be there.

To Reproduce:

  1. Checkout repository with a file.
  2. Move the file to ~.
  3. Try to upload it using this action.

Example Github Action:

name: Ubuntu

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout 
        uses: actions/checkout@v3

      - name: Move file
        run: mv ./README.md ~/README.md

      - name: Create release artifact
        uses: softprops/action-gh-release@v1
        with:
          files: ~/README.md
          tag_name: issue
          token: ${{ secrets.GITHUB_TOKEN }}

Expected behavior:
The file from home directory is uploaded to the release.

Additional Info:

@LightTab2
Copy link
Author

LightTab2 commented Jun 21, 2023

This is because ~ has different meaning in GitHub Actions: definine version range constraint.

Use ${{ runner.home }} as replacement.

@LightTab2
Copy link
Author

LightTab2 commented Jun 21, 2023

Actually some of the actions allow for ~ usage in path, so maybe this is a valid thing to consider.

Example step for actions/cache@v3:

steps:
      - name: Cache node modules
        uses: actions/cache@v3
        env:
          cache-name: cache-node-modules
        with:
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-

@LightTab2 LightTab2 reopened this Jun 21, 2023
@Bilge
Copy link

Bilge commented Nov 6, 2023

Use ${{ runner.home }} as replacement.

${{ runner.home }} doesn't exist.

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

No branches or pull requests

2 participants