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

Can't get since_last_remote_commit to work properly on pull_request event #276

Closed
2 tasks done
Balrrach opened this issue Dec 4, 2021 · 14 comments · Fixed by #278
Closed
2 tasks done

Can't get since_last_remote_commit to work properly on pull_request event #276

Balrrach opened this issue Dec 4, 2021 · 14 comments · Fixed by #278
Labels
enhancement New feature or request

Comments

@Balrrach
Copy link

Balrrach commented Dec 4, 2021

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

If I am not mistaken since_last_remote_commit option compares all changes between the last commit available in remote.
When using the next step:

- name: Check changes
        id: changed-files
        uses: tj-actions/changed-files@v11.8
        with:
          # fetch-depth: 0
          since_last_remote_commit: 'true'

I get the following result: README.md iv.yaml package.json
I am changing only the github action file between pushes, how is it possible?. What am I missing?.

Describe the solution you'd like?

Explanation of current behabior

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Balrrach Balrrach added the enhancement New feature or request label Dec 4, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2021

Thanks for reporting this issue.

@jackton1
Copy link
Member

jackton1 commented Dec 4, 2021

Can you try using the latest release: v11.8

@Balrrach
Copy link
Author

Balrrach commented Dec 4, 2021

I have but I get the same results

@jackton1
Copy link
Member

jackton1 commented Dec 4, 2021

Can you add more information about the full workflow setup, also note that the fetch-depth: 0 is required by the checkout action.

See: https://github.com/tj-actions/changed-files#usage

@Balrrach
Copy link
Author

Balrrach commented Dec 4, 2021

    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Comprobar qué archivos han cambiado
        id: changed-files
        uses: tj-actions/changed-files@v11.8
        with:
          since_last_remote_commit: 'true'

      - name: Dockerfile o requerimientos han cambiado
        id: set-output
        run: |
          for file in ${{ steps.changed-files.outputs.modified_files }}; do
            echo "$file was added"
          done

That the whole setup.

@jackton1
Copy link
Member

jackton1 commented Dec 4, 2021

What's the output from the logs ??

Ideally uploading the logs would be helpful.

@Balrrach
Copy link
Author

Balrrach commented Dec 4, 2021

Sure,

2021-12-04T20:07:17.0084702Z   GITHUB_SERVER_URL: https://github.com
2021-12-04T20:07:17.0085466Z   GITHUB_REPOSITORY: Balrrach/Instant-Eat
2021-12-04T20:07:17.0085965Z   GITHUB_BASE_REF: main
2021-12-04T20:07:17.0086705Z   INPUT_SHA: a4f1a16a7ba739163a6d2b38993b89a298e01a0c
2021-12-04T20:07:17.0087419Z   INPUT_BASE_SHA: 2b263f221080d517d56da69af05942c5874d8ace
2021-12-04T20:07:17.0088536Z   INPUT_TOKEN: ***
2021-12-04T20:07:17.0088927Z   INPUT_FILES: 
2021-12-04T20:07:17.0089334Z   INPUT_SEPARATOR:  
2021-12-04T20:07:17.0089887Z   INPUT_PATH: 
2021-12-04T20:07:17.0090861Z ##[endgroup]
2021-12-04T20:07:17.0171864Z ##[group]changed-files
2021-12-04T20:07:17.0172660Z Resolving repository path...
2021-12-04T20:07:17.0204370Z Setting up 'temp_changed_files' remote...
2021-12-04T20:07:17.0241233Z No 'temp_changed_files' remote found
2021-12-04T20:07:17.0242818Z Creating 'temp_changed_files' remote...
2021-12-04T20:07:17.0252693Z error: No such remote: 'temp_changed_files'
2021-12-04T20:07:17.0274267Z Getting HEAD info...
2021-12-04T20:07:17.2098553Z remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
2021-12-04T20:07:17.2135489Z From https://github.com/Balrrach/Instant-Eat
2021-12-04T20:07:17.2137442Z  * branch            2b263f221080d517d56da69af05942c5874d8ace -> FETCH_HEAD
2021-12-04T20:07:17.2174514Z Retrieving changes between 2b263f221080d517d56da69af05942c5874d8ace (main) → a4f1a16a7ba739163a6d2b38993b89a298e01a0c (Objetivo-6)
2021-12-04T20:07:17.2176445Z Getting diff...
2021-12-04T20:07:17.2491214Z Added files: .circleci/config.yml .github/workflows/run_tests.yml .github/workflows/update_pr_container.yml docs/ci.md
2021-12-04T20:07:17.2493269Z Copied files: 
2021-12-04T20:07:17.2494293Z Deleted files: 
2021-12-04T20:07:17.2495843Z Modified files: README.md iv.yaml package.json
2021-12-04T20:07:17.2497209Z Renamed files: .github/workflows/create_pr_container.yml .github/workflows/update_main_container.yml docs/test_framework.md
2021-12-04T20:07:17.2498493Z Type Changed files: 
2021-12-04T20:07:17.2499356Z Unmerged files: 
2021-12-04T20:07:17.2500358Z Unknown files: 
2021-12-04T20:07:17.2501961Z All changed files: .circleci/config.yml .github/workflows/create_pr_container.yml .github/workflows/run_tests.yml .github/workflows/update_main_container.yml .github/workflows/update_pr_container.yml README.md docs/ci.md docs/test_framework.md iv.yaml package.json
2021-12-04T20:07:17.2504477Z All modified files: .circleci/config.yml .github/workflows/create_pr_container.yml .github/workflows/run_tests.yml .github/workflows/update_main_container.yml .github/workflows/update_pr_container.yml README.md docs/ci.md docs/test_framework.md iv.yaml package.json

@Balrrach
Copy link
Author

Balrrach commented Dec 4, 2021

It seems to me like its not comparing to the right commit

@jackton1
Copy link
Member

jackton1 commented Dec 4, 2021

From the logs seems this is triggered by a pull_request based event which uses the last commit on the base branch in this case main (latest commit/HEAD) -> PR branch (latest commit/HEAD)

If you'll like to use the last remote commit on the same branch you can switch

on:
  pull_request:
    branches:
      - main

TO

on:
  push:
    branches:
      - "**"  # OR: Objetivo-6

@Balrrach
Copy link
Author

Balrrach commented Dec 4, 2021

But I want the action to only trigger on pull requests

@jackton1
Copy link
Member

jackton1 commented Dec 4, 2021

Which commit are you expecting to use ??

  • The last commit on the PR branch
  • The first commit on the PR branch
  • Another commit on the PR branch
  • The last commit on main
  • Another commit on main

@Balrrach
Copy link
Author

Balrrach commented Dec 4, 2021

The last commit on the pull request branch

jackton1 added a commit that referenced this issue Dec 4, 2021
jackton1 added a commit that referenced this issue Dec 4, 2021
* Fixed regression bug with base_sha for pull_request

Fixes: #276

* Update action.yml

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh
@jackton1
Copy link
Member

jackton1 commented Dec 4, 2021

@Balrrach This should be resolved in the latest release. Thanks

@Balrrach
Copy link
Author

Balrrach commented Dec 4, 2021

I can confirm the problem is solved. Thanks a lot for the fast answer!

@Balrrach Balrrach changed the title I cant get since_last_remote_commit to work properly on pull_request event Cant get since_last_remote_commit to work properly on pull_request event Dec 4, 2021
@Balrrach Balrrach changed the title Cant get since_last_remote_commit to work properly on pull_request event Can't get since_last_remote_commit to work properly on pull_request event Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants