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

How to see the changed files after the PR is merged ? #874

Closed
DimasAdinugroho opened this issue Dec 16, 2022 · 6 comments
Closed

How to see the changed files after the PR is merged ? #874

DimasAdinugroho opened this issue Dec 16, 2022 · 6 comments

Comments

@DimasAdinugroho
Copy link

DimasAdinugroho commented Dec 16, 2022

I have a github action that running after the PR is closed and merged. But how do I see the changed files between the target branch (devel) before merged and the last commit of the source branch ? This is my current yaml file:

name: test

on:
  pull_request:
    types: [ closed ]
    branches:
      - devel

jobs:
  check_pr:
    runs-on: ubuntu-latest    
    if: github.event.pull_request.merged == true
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Get changed files
        id: changed-files-models
        uses: tj-actions/changed-files@v34
        with:
          files: |
              my-directory/**
@github-actions
Copy link
Contributor

Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience.

@kahochoi
Copy link

I'm also meeting the same problem. the error message is as below.
image

When a PR is closed and the feature branch is merged to the main branch, the workflow listing the change file fails.
the yaml is as below.

name: deployment

on:
  pull_request:
    branches: 
      - main
    types: [closed]

jobs:
  cd:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0  

      - name: Get changed py files in the docs folder
        id: changed-py-files
        uses: tj-actions/changed-files@v34
        with:
          files: |
            python_files/**/*.py
          separator: ";"

@jackton1
Copy link
Member

jackton1 commented Dec 16, 2022

@DimasAdinugroho I believe the setup you have is correct this would show all changes between the target branch and the PR branch you can optionally use

on:
  push:
    branches:
      - main

jobs:
  check_pr:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Get changed files
        id: changed-files-models
        uses: tj-actions/changed-files@v34
        with:
          since_last_remote_commit: true
          files: |
              my-directory/**

Main last remote commit A..B (Latest commit which includes changes from the Pull Request)

See: https://github.com/tj-actions/changed-files/blob/main/.github/workflows/test.yml and https://github.com/tj-actions/changed-files#examples for more examples

@jackton1
Copy link
Member

@kahochoi I believe your issue is different as this appears to likely have been resolved with the lastest release. Let me know if the issue persist, in which case I'll suggest creating a new Issue.

@yuku
Copy link

yuku commented Dec 17, 2022

I also meet the same problem. Adding since_last_remote_commit: true didn't fix it. 😢

@jackton1
Copy link
Member

@yuku I’ll suggest upgrading to the latest release.

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

4 participants