Add workdir input (#55)

This commit is contained in:
Tim Harris 2020-08-28 16:30:49 -04:00 committed by GitHub
parent 7b5f85f38b
commit d2c8669ec3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 1 deletions

View file

@ -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) [![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) [![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. GitHub Action to easily import a GPG key.
@ -22,6 +22,7 @@ ___
* [Sign commits](#sign-commits) * [Sign commits](#sign-commits)
* [Customizing](#customizing) * [Customizing](#customizing)
* [inputs](#inputs) * [inputs](#inputs)
* [outputs](#outputs)
* [environment variables](#environment-variables) * [environment variables](#environment-variables)
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot) * [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
* [How can I help?](#how-can-i-help) * [How can I help?](#how-can-i-help)
@ -137,6 +138,7 @@ Following inputs can be used as `step.with` keys
| `git_push_gpgsign`**¹** | Bool | Sign all pushes automatically. (default `false`) | | `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_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) | | `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. > **¹** `git_user_signingkey` needs to be enabled for these inputs to be used.

View file

@ -29,6 +29,10 @@ inputs:
git_committer_email: git_committer_email:
description: 'Commit author''s email' description: 'Commit author''s email'
required: false required: false
workdir:
description: 'Working directory (below repository root)'
default: '.'
required: false
outputs: outputs:
fingerprint: fingerprint:

5
dist/index.js generated vendored
View file

@ -295,6 +295,11 @@ function run() {
const git_push_gpgsign = /true/i.test(core.getInput('git_push_gpgsign')); const git_push_gpgsign = /true/i.test(core.getInput('git_push_gpgsign'));
const git_committer_name = core.getInput('git_committer_name'); const git_committer_name = core.getInput('git_committer_name');
const git_committer_email = core.getInput('git_committer_email'); const git_committer_email = core.getInput('git_committer_email');
const workdir = core.getInput('workdir') || '.';
if (workdir && workdir !== '.') {
core.info(`📂 Using ${workdir} as working directory...`);
process.chdir(workdir);
}
core.info('📣 GnuPG info'); core.info('📣 GnuPG info');
const version = yield gpg.getVersion(); const version = yield gpg.getVersion();
const dirs = yield gpg.getDirs(); const dirs = yield gpg.getDirs();

View file

@ -17,6 +17,12 @@ async function run(): Promise<void> {
const git_push_gpgsign = /true/i.test(core.getInput('git_push_gpgsign')); 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_name: string = core.getInput('git_committer_name');
const git_committer_email: string = core.getInput('git_committer_email'); 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'); core.info('📣 GnuPG info');
const version = await gpg.getVersion(); const version = await gpg.getVersion();