2

I have a Github workflow and below is the file:

workflow_dispatch:  

jobs:
  cypress-run:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - run: echo "TEMP PIPELINE FOR Fix-GithubSecrets"
      - run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
      - run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      
      - name: Checkout
        uses: actions/checkout@v1

      - name: Run npm ci
        uses: actions/setup-node@v1
      - run: npm ci

      - name: Run Cypress Tests
        env:
          CYPRESS_QA_AUTH_TOKEN_BUYER: ${{ secrets.QA_AUTH_TOKEN_BUYER }}
          CYPRESS_QA_AUTH_TOKEN_INTERNAL: ${{ secrets.QA_AUTH_TOKEN_INTERNAL }}
          CYPRESS_QA_AUTH_TOKEN_SELLER: ${{ secrets.QA_AUTH_TOKEN_SELLER }}
          CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CYPRESS_APIPASSWORD: ${{ secrets.CYPRESS_APIPASSWORD }}
          CYPRESS_APIUSERNAME: ${{ secrets.CYPRESS_APIUSERNAME }}
          CYPRESS_TOKEN: ${{ secrets.CYPRESS_TOKEN }}
        uses: cypress-io/github-action@v2
        with:
          record: true

      - name: Upload Screenshot Artifacts
        uses: actions/upload-artifact@v1
        if: failure()
        with:
          name: cypress-screenshots
          path: cypress/screenshots

And when I run this I am getting error: Path does not exist /home/runner/work/cypress-tests/cypress-tests/cypress/screenshots

How do I create the screenshot folder with the above workflow?

ouflak
  • 2,458
  • 10
  • 44
  • 49
anyuzer
  • 21
  • 3

1 Answers1

0

Add a step creating the folder first:

      - name: Run Cypress Tests
        ...
      - name: Create folder
        run: |
          mkdir -p cypress/screenshots
      - name: Upload Screenshot Artifacts
        ...

You can seen other examples in "How to create a folder in github workflow?".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • did not work @vonC Still seeing the same error. This is my yml file now `- name: Create folder run: mkdir -p cypress/screenshots - name: Upload Screenshot Artifacts uses: actions/upload-artifact@v1 if: failure() with: name: cypress-screenshots path: cypress/screenshots ` – anyuzer Jan 06 '22 at 05:39
  • @anyuzer Can you try without the last `Upload Screenshot Artifacts`? Just to check if the folder is created. – VonC Jan 06 '22 at 09:05