Git Product home page Git Product logo

Comments (8)

chrispat avatar chrispat commented on June 11, 2024 1

@damirstuhec as documented on: issues: triggers will always run on the default branch as issues don't really have a ref they are associated with.

from toolkit.

damccorm avatar damccorm commented on June 11, 2024

Not sure I completely understand the ask, but in general github.context.ref should have branch info if its available I believe.

I guess I'm not really sure what you mean by "the feature branch from which the comment originated though" - comments aren't really inherently tied to branches - I may be missing something though.

from toolkit.

DanTup avatar DanTup commented on June 11, 2024

I'd like access to the branch name generally in the workflow too. I'm porting some things from Travis and I currently upload test results and logs to S3 (to power a web-based dashboard) in a folder {branch_name}/{hash} but using github.ref results in them going in a folder called /refs/heads/{branch_name} which is weird (alternatively, a function that can be used to strip it off would work too).

from toolkit.

damccorm avatar damccorm commented on June 11, 2024

Yeah, a convenience function there seems like it could be nice. For now, you can probably do something like:

var branchName = github.context.ref;
if (branchName.indexOf('/refs/heads/') > -1) {
  branchName = branchName.slice('/refs/heads/'.length);
}

from toolkit.

DanTup avatar DanTup commented on June 11, 2024

@damccorm in my case I'm just trying to use it in the workflow file rather than an action - I don't think I can put arbitrary JS in there?

  - name: Upload logs to Amazon S3
    run: dpl --provider=s3 --local-dir=".test_results" --upload-dir="${{ github.ref }}/${{ github.sha }}"

from toolkit.

damirstuhec avatar damirstuhec commented on June 11, 2024

@damccorm

var branchName = github.context.ref;
if (branchName.indexOf('/refs/heads/') > -1) {
  branchName = branchName.slice('/refs/heads/'.length);
}

I tried that but the branchName is always master, even when the issue_comment is posted on another branch (PR).

Basically, my use case is a workflow that runs when a specific issue_comment is posted on a feature branch (PR) which will then trigger a CircleCI job for that branch through their API. Unfortunately, CircleCI only supports triggering the build by a branch name.

from toolkit.

DanTup avatar DanTup commented on June 11, 2024

@damirstuhec I don't know if it'll be populated for comments, but there's a head_ref and base_ref listed here. It says they're only populated for PR events, but I'm not sure exactly what that means.

from toolkit.

bryanmacfarlane avatar bryanmacfarlane commented on June 11, 2024

Closing this out since @chrispat answered ^^ and not so much a toolkit issue. Thanks!

from toolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.