question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

context.config reads from primary branch, not current commit

See original GitHub issue

Bug Report

Current Behavior context.config() reads the configuration from the primary branch (i.e. master) rather than the current commit.

  1. Create branch in current repo
  2. Add a .github/testconfig.yml with some non-default configuration
  3. Commit it to the new branch, and push
  4. Open a pull request
  // Your code here
module.exports = robot => {
  robot.on('pull_request.opened', async context => {
    console.log(await context.config('testconfig.yml'));
  });
}

Expected behavior/code The changes made in the pull request should apply to any events run for that pull request (including pull_request, check_suite, check_run, etc).

Environment

  • Probot version(s): 6.1.0
  • Node/npm version: n/a
  • OS: n/a

Possible Solution

When fetching the content of the file, add the additional optional ref parameter. (Possibly via a flag to context.config.)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rmccuecommented, Jun 13, 2018

I think it makes sense for the default to be master, but it entirely depends on what sort of bot you’re writing. A lot of the probot-based bots I see are related to meta-level things in the repository, and those make sense to use the default branch. However, the bot that I’m primarily working on is for build tools. For things like this, you want to use the config for the specific branch, allowing you to change build rules and see what the result is before merging.

Creating a test repo to try a different build config makes no sense, but it is sensible for repo-level configuration. Making probot a tool only to handle the latter would exclude a lot of use cases. 😃

0reactions
stale[bot]commented, Aug 12, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

There is no tracking information for the current branch
This happens due to current branch has no tracking on the branch on the remote. so you can do it ... git branch...
Read more >
Git - git-config Documentation
If the repository configuration file is missing or unreadable, git config will exit with a non-zero error code. An error message is produced...
Read more >
Apply changes from one Git branch to another
Select the branch that you want to merge into the current branch, click Modify options and choose from the following: --no-ff : a...
Read more >
Configuring CircleCI
See Workflows for configuring branch execution for jobs in a workflow or 2.1 ... This is because the primary container is typically used...
Read more >
git rebase | Atlassian Git Tutorial
This page will take a more detailed look at git rebase configuration and execution ... You want to get the latest updates to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found