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

Calculated filenames are not found. #10

Closed
joergi opened this issue Oct 12, 2020 · 2 comments
Closed

Calculated filenames are not found. #10

joergi opened this issue Oct 12, 2020 · 2 comments

Comments

@joergi
Copy link

joergi commented Oct 12, 2020

At the moment I'm using in my project the file-existence-action to check if some files are available.

I download some files.
I'm assuming that the file 93.pdf is there
but, as I want to have the complete test dynamical, I read the number from a file...

bash-linux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.2
      - uses: pCYSl5EDgo/cat@master
        id: read_recent
        with:
          path: issues.txt
          trim: true
      - run: echo $TEXT
        env:
          TEXT: ${{ steps.read_recent.outputs.text }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - uses: actions/checkout@v2.3.2
      - name: Download Issues with start and end limit
        id: normalIssuesWithRange
        run: bash ./linux_mac/magpi-issue-downloader.sh -f $((${{steps.read_recent.outputs.text}}-6)) -l $((${{steps.read_recent.outputs.text}}-5))
.
.
.
     - name: "Check file existence Linux"
        id: check_files
        uses: andstor/file-existence-action@v1
        with:
          files: "issues/MagPi$((${{steps.read_recent.outputs.text}}-5)).pdf"
          allow_failure: false
      - name: lslah
        run: ls -lah  issues
      - name: File exists
        if: steps.check_files.outputs.files_exists == 'false'
        run: exit 1

The download itself works, as I can see in the lslah

The problem is, that the file existence check is looking for:
These files doesn't exist: issues/MagPi$((98-5)).pdf
see here

I guess it has something todo with this fs.access problem @elizabrock was also writing!
as @elizabrock wrote: it "checks for the literal existence of the string that is passed in."

Is there any way to solve this by calculate it in the action?

@joergi joergi changed the title calculted filenames are not found. Calculated filenames are not found. Oct 12, 2020
@andstor
Copy link
Owner

andstor commented Oct 13, 2020

Hi 👋

What you are trying to do here is to run evaluate an arithmetic expression in bash. This action currently takes a string input. I do not think (at least for now) that we should eval the strings as bash "commands". Allowing globs you would greatly simplify the file-name matching by matching the file names with a pattern, but that's a whole other story.

Instead, I suggest you add an additional step for calculating the required string input for the action (for example with bash). Then you set the result as an output, see outputs for composite run steps actions , and use this output variable in the file-existence-action files: "issues/MagPi${{steps.calculated_recent_read.outputs.text}}.pdf".

We could of course add a flag for "evaluating" the input string, but then I would need some more arguments for why such a feature is necessary.

@joergi
Copy link
Author

joergi commented Oct 28, 2022

I did it now with extra separated calculated variables. and that works!
I close this issue for now, thank you

@joergi joergi closed this as completed Oct 28, 2022
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