Skip to content

Commit 3dd1e71

Browse files
authored
Merge pull request #1 from MechTee/master
Make PDF generation optional and provide markdown
2 parents ee69401 + b0812bb commit 3dd1e71

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ You need to provide 2 refs to the action, `head` and `base`. The action steps ar
1111
1. Fetch all the commits between the `head` and `base` refs
1212
2. Find any reference to JIRA ticket numbers, based on the `jira-code` you provide
1313
3. Will fetch the ticket titles using the `jira-host`, `jira-username` and `jira-password` you provide
14-
4. Will generate a pdf with the list of changed tickets, and output the file path under the `pdf` variable
15-
5. (OPTIONAL) If the `email-to` and `sendgrid-api-key` are provided, and email will be sent with the notes
14+
4. If `pdf` is set to true:
15+
4.1. Will generate a pdf with the list of changed tickets, and output the file path under the `pdf` variable
16+
otherwise
17+
4.2. Will generate markdown with the list of changed tickets, and output it under the `markdown` variable
18+
6. (OPTIONAL) If the `email-to` and `sendgrid-api-key` are provided, and email will be sent with the notes
1619

1720
## Credentials: Passwords vs API Tokens
1821

@@ -83,6 +86,9 @@ Subject of the release email
8386

8487
Name of the app or service
8588

89+
### pdf
90+
If set to true, will generate pdf otherwise markdown, default: false
91+
8692
### unshallow
8793

8894
If set to true, will unshallow the repository before fetching the commits, default: false
@@ -93,6 +99,9 @@ If set to true, will unshallow the repository before fetching the commits, defau
9399

94100
The path of the generated pdf
95101

102+
### `markdown`
103+
The markdown generated
104+
96105
## Example usage
97106

98107
```yaml
@@ -123,8 +132,9 @@ jobs:
123132
124133
sendgrid-api-key: ${{secrets.sendgrid_api_key}}
125134
app-name: 'My Awesome Service'
135+
pdf: true
126136
unshallow: true
127137
- name: Process the pdf
128138
run: echo "The generated pdf was ${{ steps.pdf_generator.outputs.pdf }}"
129139

130-
```
140+
```

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ inputs:
3131
app-name:
3232
description: 'Name of the app or service'
3333
required: false
34+
pdf:
35+
description: 'If set to true, will return pdf output otherwise will return markdown output'
36+
required: false
37+
default: false
3438
unshallow:
3539
description: 'If set to true, will unshallow the repository before fetching the commits'
3640
required: false
@@ -43,4 +47,4 @@ branding:
4347
color: "blue"
4448
runs:
4549
using: 'node12'
46-
main: 'index.js'
50+
main: 'index.js'

index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const options = {
4040
jiraUsername: readString('jira-username'),
4141
jiraPassword: readString('jira-password'),
4242
unshallow: readBoolean('unshallow'),
43+
pdf: readBoolean('pdf'),
4344
emailTo: readString('email-to'),
4445
emailSubject: readString('email-subject'),
4546
sendgridApiKey: readString('sendgrid-api-key'),
@@ -48,10 +49,14 @@ const options = {
4849

4950
async function runAction() {
5051
try {
51-
const { pdf } = await execute(options);
52-
53-
core.setOutput("pdf", pdf);
54-
console.log("Generated pdf " + pdf);
52+
const result = await execute(options);
53+
if (options.pdf) {
54+
core.setOutput("pdf", result.pdf);
55+
console.log("Generated pdf " + pdf);
56+
} else {
57+
core.setOutput("markdown", result.markdown);
58+
console.log("Generated markdown: " + result.markdown);
59+
}
5560
} catch (e) {
5661
const message = e && e.message || 'Something went wrong';
5762
core.setFailed(message);
@@ -62,4 +67,4 @@ if (options.emailTo && !options.sendgridApiKey) {
6267
core.setFailed('The sendgrid-api-key option is required for sending emails');
6368
} else {
6469
runAction();
65-
}
70+
}

0 commit comments

Comments
 (0)