Skip to content

Add working-directory support #18

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

Merged
merged 4 commits into from
May 21, 2020
Merged

Add working-directory support #18

merged 4 commits into from
May 21, 2020

Conversation

RX14
Copy link
Contributor

@RX14 RX14 commented May 21, 2020

Fixes #15

src/run.ts Outdated
@@ -55,11 +57,16 @@ async function runLint(lintPath: string): Promise<void> {
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
}

const workingDirectory = path.resolve(core.getInput(`working-directory`))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it work if user didn't specify working-directory? maybe we should check that the input was set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will work because getInput returns ''. This behaviour is tested in the actions/core test suite so I don't expect it to change.

Resolving the empty string relative to the current working directory, returns the current working directory.

I can make this more explicit if you wish though.

Copy link
Contributor

@jirfag jirfag May 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, I would prefer more explicit logic or unit test on it. I'm not sure that this behavior of path.resolve is guaranteed and will remain e.g. after updating path library.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm certain it will. Because:

If after processing all given path segments an absolute path has not yet been generated, the current working directory is used.

but sure, I'll make this explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@RX14
Copy link
Contributor Author

RX14 commented May 21, 2020

Pushed an update to the action.yml as well, it was out of date with respect to the github token (though i can put that in another PR if you really want) and I added working-directory.

@jirfag
Copy link
Contributor

jirfag commented May 21, 2020

thank you very much!
I've invited you into golangci organization: after accepting the invitation you will be able to label issues and pull requests, review pull requests and merge approved pull requests

@jirfag jirfag merged commit 20d5541 into golangci:master May 21, 2020
@RX14
Copy link
Contributor Author

RX14 commented May 21, 2020

Thank you!

And while I appreciate the invitation, I'm probably a little too busy to be much use around here :P

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.

Allow specifying directory
2 participants