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

Add workdir input #55

Merged
merged 5 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Become a sponsor](https://img.shields.io/badge/sponsor-crazy--max-181717.svg?logo=github&style=flat-square)](https://github.com/sponsors/crazy-max)
[![Paypal Donate](https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal&style=flat-square)](https://www.paypal.me/crazyws)

## About
## About <!-- omit in toc -->

GitHub Action to easily import a GPG key.

Expand All @@ -22,6 +22,7 @@ ___
* [Sign commits](#sign-commits)
* [Customizing](#customizing)
* [inputs](#inputs)
* [outputs](#outputs)
* [environment variables](#environment-variables)
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
* [How can I help?](#how-can-i-help)
Expand Down Expand Up @@ -137,6 +138,7 @@ Following inputs can be used as `step.with` keys
| `git_push_gpgsign`**¹** | Bool | Sign all pushes automatically. (default `false`) |
| `git_committer_name`**¹** | String | Set commit author's name (defaults to the name associated with the GPG key) |
| `git_committer_email`**¹** | String | Set commit author's email (defaults to the email address associated with the GPG key) |
| `workdir` | String | Working directory (below repository root) |

> **¹** `git_user_signingkey` needs to be enabled for these inputs to be used.

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ inputs:
git_committer_email:
description: 'Commit author''s email'
required: false
workdir:
description: 'Working directory (below repository root)'
default: '.'
required: false

outputs:
fingerprint:
Expand Down
5 changes: 5 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ async function run(): Promise<void> {
const git_push_gpgsign = /true/i.test(core.getInput('git_push_gpgsign'));
const git_committer_name: string = core.getInput('git_committer_name');
const git_committer_email: string = core.getInput('git_committer_email');
const workdir: string = core.getInput('workdir') || '.';

if (workdir && workdir !== '.') {
core.info(`📂 Using ${workdir} as working directory...`);
process.chdir(workdir);
}

core.info('📣 GnuPG info');
const version = await gpg.getVersion();
Expand Down