Skip to content

Commit

Permalink
Add workdir input (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
timharris777 authored Aug 28, 2020
1 parent 7b5f85f commit d2c8669
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
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

0 comments on commit d2c8669

Please sign in to comment.