Skip to content
TheChatArchiveThe Chat Archive
gpt-4-0314· openaiHugging Face Suzhen/CodeChat

I have this github action : on: push: branches: [feature/lint-update, manu] name:…

  1. User

    I have this github action :

    on: push: branches: [feature/lint-update, manu]

    name: cppcheck-action

    jobs: build: name: cppcheck runs-on: ubuntu-latest steps: - name: Create Report folder run: | mkdir -p ./lint-reports

      - uses: actions/checkout@v2
      - name: cppcheck
        uses: deep5050/cppcheck-action@main
        with:
          github_token: ${{ secrets.GITHUB_TOKEN}}
          # exclude_check:
          inline_suppression: enable
          output_file: ./cppcheck_report.txt
    
    
      - name: publish report    
        uses: mikeal/publish-to-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BRANCH_NAME: 'feature/lint-update' # your branch name goes here
    

    This works fine. However, when I try to change the output file to be in a directory (./lint-reports/cppcheck_report.txt). The file does not get created, and doesn't get pushed either. Please fix it.

  2. Assistant

    The issue might be related to the working directory not being set to the root of the repository. In the publish report step, try specifying the working directory explicitly by adding a with section that indicates the path for the GitHub action to run:

    on:
      push:
        branches: [feature/lint-update, manu]
    
    name: cppcheck-action
    
    jobs:
      build:
        name: cppcheck
        runs-on: ubuntu-latest
        steps:
          - name: Create Report folder
            run: |
              mkdir -p ./lint-reports
    
          - uses: actions/checkout@v2
          - name: cppcheck
            uses: deep5050/cppcheck-action@main
            with:
              github_token: ${{ secrets.GITHUB_TOKEN}}
              # exclude_check:
              inline_suppression: enable
              output_file: ./lint-reports/cppcheck_report.txt
    
          - name: publish report    
            uses: mikeal/publish-to-github-action@master
            with:
              path: ./lint-reports
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              BRANCH_NAME: 'feature/lint-update' # your branch name goes here
    

    This way, the action will know where to create and push the cppcheck_report.txt file.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.