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

[Feature] Support issue comment created trigger scenario in pull request #1667

Closed
2 tasks done
hansarh opened this issue Oct 25, 2023 · 3 comments · Fixed by #1742 or #1744
Closed
2 tasks done

[Feature] Support issue comment created trigger scenario in pull request #1667

hansarh opened this issue Oct 25, 2023 · 3 comments · Fixed by #1742 or #1744
Labels
enhancement New feature or request

Comments

@hansarh
Copy link

hansarh commented Oct 25, 2023

Is this feature missing in the latest version?

  • I'm using the latest release

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

I'm using the branch deploy action which is triggered on in Pull requests:

# The workflow to execute on is comments that are newly created
on:
  issue_comment:
    types: [created]

For this trigger the github context is the default branch which I'm changing to the PR branch by using the ref output of branch-deploy.
I'm using the sha output of branch deploy as input for sha in this action, but it seems like it only checks for changes against the previous commit in this scenario.

      - uses: actions/checkout@v3
        with:
          ref: ${{ inputs.ref }}
          fetch-depth: 0

      # Check if any files in the src/app folder has changed
      - name: Check changes in source code folder
        id: changed-files-specific
        uses: tj-actions/changed-files@v39
        with:
          files: '${{inputs.srcdir}}/**'
          sha: ${{ inputs.sha }}

image

Describe the solution you'd like?

I want it to work more like the PR scenario where it checks against the default branch or the base_sha of the PR branch. I guess it would work if I was able to in addition input the base_sha, but I only have base_ref as an output from the branch deploy action.

Is there any way you see I can achieve this?

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@hansarh hansarh added the enhancement New feature or request label Oct 25, 2023
@jackton1
Copy link
Member

HI @hansarh you can use the base_sha input in that case passing the base_ref output from the branch-deploy action.

Here is an example:

- name: Get changed files
  id: changed-files
  uses: tj-actions/changed-files@v39
  with:
    sha: ${{ inputs.sha }}
    base_sha: ${{ steps.branch-deploy.outputs.base_ref }}
    files: '${{inputs.srcdir}}/**'

@hansarh
Copy link
Author

hansarh commented Nov 23, 2023

Thanks for the reply. I've tried passing in the base_ref output from the branch deploy action and also using github.base_ref as the default input for base_sha used when context is pr and push to main. They both seems to just generate the value main since I'm testing with a branch to merge to main. This generates an error:
image

I'm using fetch depth 0 in the checkout action. Any ideas to how I can fix this?
@jackton1

@jackton1
Copy link
Member

jackton1 commented Nov 26, 2023

Hi @hansarh, okay looks like this might not be fully supported yet. I'll reopen this issue and add support for passing the branch names instead of the commit sha

@jackton1 jackton1 reopened this Nov 26, 2023
@jackton1 jackton1 changed the title [Support issue comment created trigger] Support issue comment created trigger scenario in pull request [Fearure] Support issue comment created trigger scenario in pull request Nov 30, 2023
@jackton1 jackton1 changed the title [Fearure] Support issue comment created trigger scenario in pull request [Feature] Support issue comment created trigger scenario in pull request Nov 30, 2023
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
2 participants