Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(propagate-content): use boolean inputs #671

Merged
merged 4 commits into from
Mar 1, 2024

Conversation

educhastenier
Copy link
Contributor

@educhastenier educhastenier commented Feb 16, 2024

as it is easier to handle boolean inputs through check boxes

as it is easier to handle through check boxes
@educhastenier educhastenier changed the title chore/set propagate inputs as booleans chore(inputs): set propagate inputs as booleans Feb 16, 2024
default: 'false'
type: boolean
description: 'If checked, send slack notifications when errors occur'
default: true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is better to change this default value to 'true'.
BTW, how did it work in the cron, as we can see that notifications are correctly sent by default?

Copy link
Contributor

Choose a reason for hiding this comment

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

The condition for the Slack notification in the workflow.
if: failure() && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.slack-notifications == 'true') )

So when the cron starts, the inputs.slack-notifications are ignored.

Copy link
Member

@tbouffard tbouffard Feb 16, 2024

Choose a reason for hiding this comment

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

About the default value, it is set to false on purpose. The input has been created mainly to troubleshoot slack issues, but not to send a message when the workflow is triggered manually.

When someone is triggering the workflow manually, it is supposed to monitor the run by themself. There is no need to pollute other Engineers with a slack notification.

@tbouffard tbouffard changed the title chore(inputs): set propagate inputs as booleans ci(propagate-content): use boolean inputs Feb 16, 2024
default: 'false'
type: boolean
description: 'If checked, send slack notifications when errors occur'
default: true
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
default: true
default: false

@@ -55,7 +55,7 @@ jobs:
./.././bonita-documentation-site/scripts/propagate_doc_upwards.bash

- name: Send message to Slack channel
if: failure() && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.slack-notifications == 'true') )
Copy link
Member

@tbouffard tbouffard Feb 16, 2024

Choose a reason for hiding this comment

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

question: did you test the change by running the action? AFAIK, whatever the type is defined in the input, the actual type at runtime in github.event.inputs is always a string, so this change may change the behavior (the input is always set, so the condition would always be true)

See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs

The workflow will also receive the inputs in the github.event.inputs context. The information in the inputs context and github.event.inputs context is identical except that the inputs context preserves Boolean values as Booleans instead of converting them to strings. The choice type resolves to a string and is a single selectable option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad, reverting it...

Copy link
Member

@tbouffard tbouffard left a comment

Choose a reason for hiding this comment

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

✔️ Tested with https://github.com/bonitasoft/bonita-documentation-site/actions/runs/8112514456 using the branch of this PR. Dry-run and no slack notifications.

image

Copy link

sonarqubecloud bot commented Mar 1, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@tbouffard tbouffard merged commit d8128b1 into master Mar 1, 2024
2 checks passed
@tbouffard tbouffard deleted the chore/set_propagate_inputs_as_booleans branch March 1, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants