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

Use head ref for PRs #16

Merged
merged 1 commit into from
Jun 17, 2022
Merged

Conversation

nick-fields
Copy link
Contributor

When triggering CircleCI pipelines on PR events, the branch that is sent to CCI is refs/pull/<pr#> but nobody needs/cares about that ref. Instead the head ref should be sent which is the branch name (minus refs/heads) that is being merged into the PR base branch.

@nick-fields
Copy link
Contributor Author

This will also resolve #13

@aalong-tr
Copy link

Thank you for writing this! I hope it gets merged, as this change is vital to my primary use-case for this action.

@paynerc
Copy link

paynerc commented May 4, 2022

I am also following this... I need to be able to add comments to PRs that trigger GH actions that start a CirlceCI pipeline, but currently it always runs against main.

@nghiadoan91
Copy link

I hope this merged soon, Im using github label to trigger in the PR

@tmountjr
Copy link

I had some problems in #18 that this could potentially resolve as well.

@Irvenae
Copy link

Irvenae commented May 25, 2022

can this be merged please?

1 similar comment
@Irvenae
Copy link

Irvenae commented May 25, 2022

can this be merged please?

@tmountjr
Copy link

@KyleTryon saw that you have occasionally merged PRs in the past - would you be able to review this and provide feedback?

@nick-fields
Copy link
Contributor Author

I'm not sure how long CircleCI takes to merge these kinds of things. Feel free to use my fork if you need something immediately, I've been using it in production for 6wks with no issues. It's worth noting I removed the GHA_Meta inputs as I didn't find value in them, see commit.

on:
  pull_request:
    types: [opened, reopened]

jobs:
  trigger-circleci:
    runs-on: ubuntu-latest
    steps:
      - name: Trigger CircleCI build
        uses: nick-fields/trigger-circleci-pipeline-action@57c093b9d0d06d35f0107ae1fb3957ef3960aaed
        env:
          CCI_TOKEN: ${{ secrets.CIRCLECI_API_TOKEN }}

@tmountjr
Copy link

@nick-fields good to know because I actually was planning on passing metadata to circle ci that way. 😬

@nick-fields
Copy link
Contributor Author

@tmountjr in that case, you can just use the sha of the commit in this PR:

on:
  pull_request:
    types: [opened, reopened]

jobs:
  trigger-circleci:
    runs-on: ubuntu-latest
    steps:
      - name: Trigger CircleCI build
        uses: nick-fields/trigger-circleci-pipeline-action@dd5d85644c1e65f107ecb7f34402c2825b2e418d
        env:
          CCI_TOKEN: ${{ secrets.CIRCLECI_API_TOKEN }}

@Irvenae
Copy link

Irvenae commented May 25, 2022

you can just use CircleCI-Public/trigger-circleci-pipeline-action@dd5d85644c1e65f107ecb7f34402c2825b2e418d btw

@KyleTryon
Copy link
Contributor

Hell all, sorry for the delay! This is being merged and deployed right now. We'll be live in a few moments. Thank you @nick-fields

@KyleTryon KyleTryon merged commit ef1944e into CircleCI-Public:main Jun 17, 2022
omxela pushed a commit to mo-work/trigger-circleci-pipeline-action that referenced this pull request Oct 9, 2022
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

Successfully merging this pull request may close these issues.

7 participants