You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2020/12/27 14:02:23 UTC
[airflow-checks-action] 21/27: Add 'details_url' input as requested
in #5
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow-checks-action.git
commit 4a05f6d092dd88b2eb5c0f984b65be4dfc0a21d0
Author: Louis Brunner <lo...@gmail.com>
AuthorDate: Mon Sep 7 17:22:05 2020 +0100
Add 'details_url' input as requested in #5
---
.github/workflows/examples.yml | 21 ++++++++++++++++++---
README.md | 10 ++++++++++
action.yml | 3 +++
dist/index.js | 2 +-
src/checks.ts | 16 ++++++++++++++++
src/inputs.ts | 2 ++
src/namespaces/Inputs.ts | 1 +
7 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml
index fbdc0c1..bd34184 100644
--- a/.github/workflows/examples.yml
+++ b/.github/workflows/examples.yml
@@ -77,7 +77,21 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
name: Test Basic Action Required
conclusion: action_required
- action_url: https://example.com
+ action_url: https://example.com/action
+ details_url: https://example.com/details
+
+ # With details
+ test_with_details:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - uses: ./
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ name: Test With Details
+ conclusion: success
+ action_url: https://example.com/action
+ details_url: https://example.com/details
## With annotations
test_with_annotations:
@@ -161,7 +175,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
name: Test With Actions
conclusion: success
- action_url: https://example.com
+ action_url: https://example.com/action
+ details_url: https://example.com/details
actions: |
[{"label":"Click Me","description":"Click me to get free RAM","identifier":"sent_to_webhook"}]
@@ -180,7 +195,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
name: Test With Actions From Run
conclusion: success
- action_url: https://example.com
+ action_url: https://example.com/action
# output.summary is required with actions!
output: |
{"summary":"Some warnings in README.md"}
diff --git a/README.md b/README.md
index 4e24efa..5b3991a 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,14 @@ _Optional_ The URL to call back to when using `action_required` as a `conclusion
See [Check Runs API (`action_required`)](https://developer.github.com/v3/checks/runs/#parameters) or [Check Runs API (`actions`)](https://developer.github.com/v3/checks/runs/#actions-object) for more information
+Note that this will override `details_url` (see next) when `conclusion` is `action_required` or when `actions` is provided (the two inputs set the same check attribute, `details_url`)
+
+### `details_url`
+
+_Optional_ A URL with more details about your check, can be an third-party website, a preview of the changes to your Github Pages, etc
+
+Note that this will be overridden by `action_url` (see previous) when `conclusion` is `action_required` or when `actions` is provided (the two inputs set the same check attribute, `details_url`)
+
### `output`
_Optional_ A JSON object (as a string) containing the output of your check, required when using `annotations` or `images`.
@@ -83,6 +91,8 @@ _Optional_ A JSON array (as a string) containing the actions of your check.
Supports the same properties with the same types and names as the [Check Runs API](https://developer.github.com/v3/checks/runs/#actions-object)
+Note that this will override `details_url` as it relies on `action_url` (the two inputs set the same check attribute, `details_url`)
+
## Issues
- Action Required conclusion: button doesn't work
diff --git a/action.yml b/action.yml
index eea8209..1457cc3 100644
--- a/action.yml
+++ b/action.yml
@@ -21,6 +21,9 @@ inputs:
action_url:
description: 'the url to call back to when using `action_required` as conclusion or with `actions`'
required: false
+ details_url:
+ description: 'a URL with more details about your check, will be overriden by `action_url` depending on context'
+ required: false
output:
description: 'the output of your check'
required: false
diff --git a/dist/index.js b/dist/index.js
index bdd3296..08d880d 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1 +1 @@
-module.exports=(()=>{var __webpack_modules__={321:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){if(s===undefined)s=r;Object.defineProperty(e,s,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,s){if(s===undefined)s=r;e[s]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var n=this&&this.__importStar||function(e [...]
\ No newline at end of file
+module.exports=(()=>{var __webpack_modules__={321:function(e,t,r){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){if(s===undefined)s=r;Object.defineProperty(e,s,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,s){if(s===undefined)s=r;e[s]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var n=this&&this.__importStar||function(e [...]
\ No newline at end of file
diff --git a/src/checks.ts b/src/checks.ts
index 3dc3dff..807d072 100644
--- a/src/checks.ts
+++ b/src/checks.ts
@@ -1,4 +1,5 @@
import {GitHub} from '@actions/github/lib/utils';
+import * as core from '@actions/core';
import * as Inputs from './namespaces/Inputs';
type Ownership = {
@@ -26,7 +27,22 @@ const unpackInputs = (inputs: Inputs.Args): Record<string, unknown> => {
conclusion?: string;
} = {};
if (inputs.conclusion === Inputs.Conclusion.ActionRequired || inputs.actions) {
+ if (inputs.detailsURL) {
+ const reasonList = [];
+ if (inputs.conclusion === Inputs.Conclusion.ActionRequired) {
+ reasonList.push(`'conclusion' is 'action_required'`);
+ }
+ if (inputs.actions) {
+ reasonList.push(`'actions' was provided`);
+ }
+ const reasons = reasonList.join(' and ');
+ core.warning(
+ `'details_url' was ignored in favor of 'action_url' because ${reasons} (see documentation for details)`,
+ );
+ }
more.details_url = inputs.actionURL;
+ } else if (inputs.detailsURL) {
+ more.details_url = inputs.detailsURL;
}
if (inputs.conclusion) {
more.conclusion = inputs.conclusion.toString();
diff --git a/src/inputs.ts b/src/inputs.ts
index 775be8e..d5a1437 100644
--- a/src/inputs.ts
+++ b/src/inputs.ts
@@ -22,6 +22,7 @@ export const parseInputs = (getInput: GetInput): Inputs.Args => {
const status = getInput('status', {required: true}) as Inputs.Status;
let conclusion = getInput('conclusion') as Inputs.Conclusion;
const actionURL = getInput('action_url');
+ const detailsURL = getInput('details_url');
if (!Object.values(Inputs.Status).includes(status)) {
throw new Error(`invalid value for 'status': '${status}'`);
@@ -64,6 +65,7 @@ export const parseInputs = (getInput: GetInput): Inputs.Args => {
conclusion,
actionURL,
+ detailsURL,
output,
annotations,
diff --git a/src/namespaces/Inputs.ts b/src/namespaces/Inputs.ts
index cc5a54e..fb9a89d 100644
--- a/src/namespaces/Inputs.ts
+++ b/src/namespaces/Inputs.ts
@@ -7,6 +7,7 @@ export type Args = {
status: Status;
actionURL: string;
+ detailsURL?: string;
output?: Output;
annotations?: Annotations;