-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update to MorphoCloud/MorphoCloudWorkflow@a710c11
List of MorphoCloudWorkflow changes: ``` $ git shortlog a29ea08..a710c11 --no-merges Jean-Christophe Fillion-Robin (3): doc(README): Mention correct runner architecture feat(validate-request): Run validation when issue is edited feat: Update request adding "confirm email" field ``` See MorphoCloud/MorphoCloudWorkflow@a29ea08...a710c11
- Loading branch information
Showing
6 changed files
with
155 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ outputs: | |
email: | ||
description: "Email" | ||
value: ${{ steps.extract.outputs.email }} | ||
confirm_email: | ||
description: "Confirm Email" | ||
value: ${{ steps.extract.outputs.confirm_email }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
|
@@ -69,3 +72,18 @@ runs: | |
sed -E 's/^<([^<>]+)>$/\1/' | ||
) | ||
echo "email=$email" >> $GITHUB_OUTPUT | ||
# Also strip "<" and ">" to convert from "<[email protected]>" to "[email protected]" | ||
confirm_email=$( | ||
echo ${{ toJSON(steps.parse.outputs.data) }} | | ||
jq -r ".confirm_email.text // empty" | | ||
sed -E 's/^<([^<>]+)>$/\1/' | ||
) | ||
# If the "Confirm Email" field is missing (e.g., in older issues), | ||
# set confirm_email to match email to ensure compatibility. | ||
if [[ -z "$confirm_email" ]]; then | ||
confirm_email="$email" | ||
fi | ||
echo "confirm_email=$confirm_email" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
issues: | ||
types: | ||
- opened | ||
- edited | ||
workflow_dispatch: | ||
inputs: | ||
issue_number: | ||
|
@@ -98,6 +99,60 @@ jobs: | |
env: | ||
EMAIL: ${{ steps.decode_email.outputs.output_string }} | ||
|
||
- name: Check if confirm email is encoded | ||
id: check_confirm_email_encryption | ||
run: | | ||
if [[ "$EMAIL" != *"@"* ]]; then | ||
encoded="true" | ||
else | ||
encoded="false" | ||
fi | ||
echo "encoded=$encoded" >> $GITHUB_OUTPUT | ||
env: | ||
CONFIRM_EMAIL: ${{ steps.extract.outputs.confirm_email }} | ||
|
||
- name: Decode confirm email | ||
id: decode_confirm_email | ||
uses: ./.github/actions/encode-decode-string | ||
with: | ||
input_string: ${{ steps.extract.outputs.confirm_email }} | ||
encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }} | ||
operation: "decode" | ||
skip: | ||
${{ steps.check_confirm_email_encryption.outputs.encoded == 'false' | ||
}} | ||
|
||
- name: Check confirm email format | ||
id: check_confirm_email_format | ||
run: | | ||
# Adapted from https://gist.github.com/guessi/82a73ee7eb2b1216eb9db17bb8d65dd1 | ||
email_regex="^(([A-Za-z0-9]+((\.|\-|\_|\+)?[A-Za-z0-9]?)*[A-Za-z0-9]+)|[A-Za-z0-9]+)@(([A-Za-z0-9]+)+((\.|\-|\_)?([A-Za-z0-9]+)+)*)+\.([A-Za-z]{2,})+$" | ||
if [[ "$CONFIRM_EMAIL" =~ $email_regex ]]; then | ||
valid="true" | ||
emojii="✅" | ||
else | ||
valid="false" | ||
emojii="❌" | ||
fi | ||
echo "valid=$valid" >> $GITHUB_OUTPUT | ||
echo "emojii=$emojii" >> $GITHUB_OUTPUT | ||
env: | ||
CONFIRM_EMAIL: ${{ steps.decode_confirm_email.outputs.output_string }} | ||
|
||
- name: Check emails match | ||
id: check_emails_match | ||
run: | | ||
if [[ "$EMAIL" == "$CONFIRM_EMAIL" ]]; then | ||
valid="true" | ||
emojii="✅" | ||
else | ||
valid="false" | ||
emojii="❌" | ||
fi | ||
env: | ||
EMAIL: ${{ steps.decode_email.outputs.output_string }} | ||
CONFIRM_EMAIL: ${{ steps.decode_confirm_email.outputs.output_string }} | ||
|
||
- name: command results comment (failure) | ||
if: ${{ failure() }} | ||
uses: peter-evans/[email protected] | ||
|
@@ -118,9 +173,18 @@ jobs: | |
body: | | ||
### Validation Results | ||
| Check | Status | | ||
| --------------- |:-------:| | ||
| ORCID iD format | ${{ steps.check_orcid_format.outputs.emojii }} | | ||
| Email format | ${{ steps.check_email_format.outputs.emojii }} | | ||
The validation checks have completed. Below is the status of each check: | ||
| Check | Status | | ||
| ----------------------- |:-------:| | ||
| ORCID iD format | ${{ steps.check_orcid_format.outputs.emojii }} | | ||
| Email format | ${{ steps.check_email_format.outputs.emojii }} | | ||
| Confirm Email format | ${{ steps.check_confirm_email_format.outputs.emojii }} | | ||
| Emails match | ${{ steps.check_emails_match.outputs.emojii }} | | | ||
> [!IMPORTANT] | ||
> If the ORCID iD format is incorrect, edit the issue description to correct it. | ||
> | ||
> If either email format is invalid or the emails do not match, please update the issue description accordingly. | ||
See details at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters