mirror of
https://github.com/tauri-apps/actions-netlify.git
synced 2026-01-31 00:45:22 +01:00
feat: add "enable-commit-status" input
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
36
dist/index.js
vendored
36
dist/index.js
vendored
@@ -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) {
|
||||
@@ -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');
|
||||
},
|
||||
|
||||
@@ -9,6 +9,7 @@ export interface Inputs {
|
||||
productionDeploy(): boolean
|
||||
enablePullRequestComment(): boolean
|
||||
enableCommitComment(): boolean
|
||||
enableCommitStatus(): boolean
|
||||
githubToken(): string
|
||||
overwritesPullRequestComment(): boolean
|
||||
netlifyConfigPath(): string | undefined
|
||||
@@ -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')
|
||||
},
|
||||
|
||||
30
src/main.ts
30
src/main.ts
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user