question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Where is the wrong in my yaml file? Main feature is not working properly.

See original GitHub issue

If I change in foo2 folder or foo folder, it triggers all steps and does not skip any steps. Some should be skipped some steps when I change something in just one of them.

My File directory is like this:

  • .github

    • workflows .main.yml
  • foo

    • js .bc-global.js
      • live .global-bundle.js .script-bundle.js
      • scripts .script1.js .script2.js .script3.js
  • foo2

    • js .lc-global.js
      • live .global-bundle.js .script-bundle.js
      • scripts .script1.js .script2.js .script3.js
name: Upload to S3

on:
  push:
    branches:
      - test-s3
    paths:
      - "foo/js/bc-global.js"
      - "foo/js/scripts/**.js"
      - "foo2/js/lc-global.js"
      - "foo2/js/scripts/**.js"

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - uses: actions/checkout@v2
      - uses: dorny/paths-filter@v2
        id: changes
        with:
          filters: |
            foo:
              - 'foo/js/bc-global.js'
              - 'foo/js/scripts/**.js'
            foo2:
              - 'foo2/js/lc-global.js'
              - 'foo2/js/scripts/**.js'

      - name: Install node
        uses: actions/setup-node@v3
        with:
          node-version: 16.13.0
          registry-url: "https://registry.npmjs.org"

      - name: Install uglify-js
        run: npm install uglify-js -g

      # minify files for each project
      - name: minify script files for foo
        if: steps.changes.outputs.foo == 'true'
        run: uglifyjs foo/js/scripts/**.js -o foo/js/live/scripts-bundle.js
      - name: minify global file for foo
        if: steps.changes.outputs.foo == 'true'
        run: uglifyjs foo/js/bc-global.js -o foo/js/live/global-bundle.js

      - name: minify script files for foo2
        if: steps.changes.outputs.foo2 == 'true'
        run: uglifyjs foo2/js/scripts/**.js -o foo2/js/live/scripts-bundle.js
      - name: minify global file for foo2
        if: steps.changes.outputs.foo2 == 'true'
        run: uglifyjs foo2/js/lc-global.js -o foo2/js/live/global-bundle.js

      # Auto committing
      - name: Auto committing minified files
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          file_pattern: "*.js"
          commit_message: "Github Action: Auto Minified JS files"
          branch: ${{ github.ref }}

      # Deploy for foo
      - name: Deploy to S3 for foo
        if: steps.changes.outputs.foo == 'true'
        uses: jakejarvis/s3-sync-action@master
        with:
          args: --follow-symlinks --cache-control max-age=600
        env:
          AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET_NAME }}
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: ${{ secrets.AWS_REGION }}
          SOURCE_DIR: "foo/js/live"
          DEST_DIR: "foo/pages/assets/js/test/"

        # Deploy for foo2
      - name: Deploy to S3 for foo2
        if: steps.changes.outputs.foo2 == 'true'
        uses: jakejarvis/s3-sync-action@master
        with:
          args: --follow-symlinks --cache-control max-age=600
        env:
          AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET_NAME }}
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: ${{ secrets.AWS_REGION }}
          SOURCE_DIR: "foo2/js/live"
          DEST_DIR: "foo2/pages/assets/js/test/"

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dornycommented, Oct 13, 2022

Your workflow is triggered by the push to test-s3 branch and changes are detected against your default (e.g. main) branch. It’s the “Feature branches” workflow. That means if you change in the first pushed commit something in “foo” and in the second pushed commit something in “foo2”, it would consider both as changed.

If you want to execute the steps based only on the changes included in the commits currently pushed, then you need to set the base input variable to be the same as the branch where you pushed the commits. See the Long lived branches example.

Hope this will solve your issue. If not, please look at the action logs. You should see exactly how the changes were detected and which files are considered to be modified.

1reaction
dornycommented, Oct 13, 2022

@ffcabbar I will take a look on it later in the evening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Errors in YAML (.YML) Config Files - Knowledgebase
If the output (on the right side) is red, read through it carefully to find out what line your errors are on. Find...
Read more >
10 YAML tips for people who hate YAML | Enable Sysadmin
Do you hate YAML? These tips might ease your pain. ... There are lots of formats for configuration files: a list of values,...
Read more >
Troubleshooting YAML - AresMUSH
If your game is running, you can use the config/check command to identify YAML problems. This guide will help you troubleshoot common errors....
Read more >
Uses the wrong schema, even when yaml.schemas is set #397
in yaml.schemas and the extension recognizes that the schema does not exist, so it is receiving the proper schema from settings.json !
Read more >
A YAML file cannot contain tabs as indentation - Stack Overflow
A YAML file use spaces as indentation, you can use 2 or 4 spaces for indentation, but no tab. In other words, tab...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found