Skip to content

Commit

Permalink
Set pr title and body to empty string if null
Browse files Browse the repository at this point in the history
Fixes tzkhan#11
  • Loading branch information
tzkhan committed May 5, 2020
1 parent 9126883 commit 9aa1881
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
pr_update_text:
runs-on: ubuntu-latest
steps:
- uses: tzkhan/pr-update-action@v1.1.0
- uses: tzkhan/pr-update-action@v1.1.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
branch-regex: '[a-z\d-_.\/]+'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
update_pr:
runs-on: ubuntu-latest
steps:
- uses: tzkhan/pr-update-action@v1.1.0
- uses: tzkhan/pr-update-action@v1.1.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" # required - allows the action to make calls to GitHub's rest API
branch-regex: 'foo-\d+' # required - regex to match text from the head branch name
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
pr_update_text:
runs-on: ubuntu-latest
steps:
- uses: tzkhan/pr-update-action@v1.1.0
- uses: tzkhan/pr-update-action@v1.1.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
branch-regex: 'foo-\d+'
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7514,7 +7514,7 @@ async function run() {
pull_number: github.context.payload.pull_request.number,
}

const title = github.context.payload.pull_request.title;
const title = github.context.payload.pull_request.title || '';
const processedTitle = inputs.titleTemplate.replace(tokenRegex, match(inputs.uppercaseTitle));
core.debug(`processedTitle: ${processedTitle}`);

Expand All @@ -7531,7 +7531,7 @@ async function run() {
core.warning('PR title is up to date already - no updates made');
}

const body = github.context.payload.pull_request.body;
const body = github.context.payload.pull_request.body || '';
const processedBody = inputs.bodyTemplate.replace(tokenRegex, match(inputs.uppercaseBody));
core.debug(`processedBody: ${processedBody}`);

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function run() {
pull_number: github.context.payload.pull_request.number,
}

const title = github.context.payload.pull_request.title;
const title = github.context.payload.pull_request.title || '';
const processedTitle = inputs.titleTemplate.replace(tokenRegex, match(inputs.uppercaseTitle));
core.debug(`processedTitle: ${processedTitle}`);

Expand All @@ -55,7 +55,7 @@ async function run() {
core.warning('PR title is up to date already - no updates made');
}

const body = github.context.payload.pull_request.body;
const body = github.context.payload.pull_request.body || '';
const processedBody = inputs.bodyTemplate.replace(tokenRegex, match(inputs.uppercaseBody));
core.debug(`processedBody: ${processedBody}`);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pr-update-action",
"version": "1.1.0",
"version": "1.1.1",
"description": "PR Update GitHub Action",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 9aa1881

Please sign in to comment.