Skip to content

Commit

Permalink
Merge branch 'release/1.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Aug 21, 2020
2 parents 23fe931 + e8da813 commit 7e491b3
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 32 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [Unreleased]

## [1.1.9] - 2020-08-21
### Added
* Add "enable-commit-status" input

## [1.1.8] - 2020-08-20
### Added
* Add GitHub commit status
Expand Down Expand Up @@ -134,7 +138,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
* Deploy to Netlify
* Comment on GitHub PR

[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.1.8...HEAD
[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.1.9...HEAD
[1.1.9]: https://github.com/nwtgck/actions-netlify/compare/v1.1.8...v1.1.9
[1.1.8]: https://github.com/nwtgck/actions-netlify/compare/v1.1.7...v1.1.8
[1.1.7]: https://github.com/nwtgck/actions-netlify/compare/v1.1.6...v1.1.7
[1.1.6]: https://github.com/nwtgck/actions-netlify/compare/v1.1.5...v1.1.6
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
- `deploy-message` A custom deploy message to see on Netlify deployment (e.g. `${{ github.event.pull_request.title }}`)
- `enable-pull-request-comment: true` Comment on pull request (default: true)
- `enable-commit-comment: true` Comment on GitHub commit (default: true)
- `enable-commit-status: true` GitHub commit status (default: true)
- `overwrites-pull-request-comment: true` Overwrites comment on pull request (default: true)
- `netlify-config-path: ./netlify.toml` Path to `netlify.toml` (default: undefined)
- `functions-dir` Netlify functions output directory (default: undefined)
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ inputs:
enable-commit-comment:
description: Enable commit comment
required: false
enable-commit-status:
description: Enable GitHub commit status
required: false
overwrites-pull-request-comment:
description: Overwrites pull request comment
required: false
Expand Down
36 changes: 21 additions & 15 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186322,21 +186322,23 @@ function run(inputs) {
// eslint-disable-next-line no-console
console.error(err);
}
try {
yield githubClient.repos.createCommitStatus({
owner: github_1.context.repo.owner,
repo: github_1.context.repo.repo,
context: 'Netlify',
description: 'Netlify deployment',
state: 'success',
sha: github_1.context.sha,
// eslint-disable-next-line @typescript-eslint/camelcase
target_url: deployUrl
});
}
catch (err) {
// eslint-disable-next-line no-console
console.error(err);
if (inputs.enableCommitStatus()) {
try {
yield githubClient.repos.createCommitStatus({
owner: github_1.context.repo.owner,
repo: github_1.context.repo.repo,
context: 'Netlify',
description: 'Netlify deployment',
state: 'success',
sha: github_1.context.sha,
// eslint-disable-next-line @typescript-eslint/camelcase
target_url: deployUrl
});
}
catch (err) {
// eslint-disable-next-line no-console
console.error(err);
}
}
}
catch (error) {
Expand Down Expand Up @@ -261628,6 +261630,10 @@ exports.defaultInputs = {
// Default: true
return (core.getInput('enable-commit-comment') || 'true') === 'true';
},
enableCommitStatus() {
// Default: true
return (core.getInput('enable-commit-status') || 'true') === 'true';
},
githubToken() {
return core.getInput('github-token');
},
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "actions-netlify",
"version": "1.1.8",
"version": "1.1.9",
"private": true,
"description": "GitHub Actions for Netlify",
"main": "lib/main.js",
Expand Down
5 changes: 5 additions & 0 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface Inputs {
productionDeploy(): boolean
enablePullRequestComment(): boolean
enableCommitComment(): boolean
enableCommitStatus(): boolean
githubToken(): string
overwritesPullRequestComment(): boolean
netlifyConfigPath(): string | undefined
Expand Down Expand Up @@ -41,6 +42,10 @@ export const defaultInputs: Inputs = {
// Default: true
return (core.getInput('enable-commit-comment') || 'true') === 'true'
},
enableCommitStatus() {
// Default: true
return (core.getInput('enable-commit-status') || 'true') === 'true'
},
githubToken() {
return core.getInput('github-token')
},
Expand Down
30 changes: 16 additions & 14 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,22 @@ export async function run(inputs: Inputs): Promise<void> {
console.error(err)
}

try {
await githubClient.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
context: 'Netlify',
description: 'Netlify deployment',
state: 'success',
sha: context.sha,
// eslint-disable-next-line @typescript-eslint/camelcase
target_url: deployUrl
})
} catch (err) {
// eslint-disable-next-line no-console
console.error(err)
if (inputs.enableCommitStatus()) {
try {
await githubClient.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
context: 'Netlify',
description: 'Netlify deployment',
state: 'success',
sha: context.sha,
// eslint-disable-next-line @typescript-eslint/camelcase
target_url: deployUrl
})
} catch (err) {
// eslint-disable-next-line no-console
console.error(err)
}
}
} catch (error) {
core.setFailed(error.message)
Expand Down

4 comments on commit 7e491b3

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.