-
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@8d38624
List of MorphoCloudWorkflow changes: ``` $ git shortlog dd76ebd..8d38624 --no-merges Jean-Christophe Fillion-Robin (1): feat: Add support for synchronous update of instance status issue label ``` See MorphoCloud/MorphoCloudWorkflow@dd76ebd...8d38624
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "Update Request Status Label" | ||
description: "Update Request Status Label" | ||
inputs: | ||
os_cloud: | ||
description: | ||
"Name of the OpenStack cloud allocation to select openstack auth settings | ||
defined in '.config/openstack/clouds.yaml'" | ||
required: true | ||
token: | ||
description: "GITHUB_TOKEN or repo scoped PAT" | ||
required: true | ||
issue_number: | ||
description: "Issue number" | ||
required: true | ||
instance_name: | ||
description: "Instance name" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Retrieve instance status | ||
id: retrieve_instance_status | ||
shell: bash | ||
run: | | ||
source ~/venv/bin/activate | ||
echo Retrieving instance "$INSTANCE_NAME" status | ||
# Get instance status | ||
instance_status=$( | ||
openstack server show $INSTANCE_NAME -c status -f json | \ | ||
jq -r .status | ||
) | ||
echo "instance_status [$instance_status]" | ||
echo "instance_status=$instance_status" >> $GITHUB_OUTPUT | ||
env: | ||
INSTANCE_NAME: ${{ inputs.instance_name }} | ||
|
||
- name: Update issues | ||
shell: bash | ||
run: | | ||
issue_number=$ISSUE_NUMBER | ||
status_lowercase=${$INSTANCE_STATUS,,} | ||
add_label="status:$status_lowercase" | ||
remove_labels=$(gh issue view $issue_number --json labels | \ | ||
jq \ | ||
-r \ | ||
--arg add_label "$add_label" \ | ||
-c '[.labels[].name | select(test("^status:")?) | select(. != $add_label)] | join(",")') | ||
echo "Updating issue $issue_number adding label [$add_label] and removing labels [$remove_labels]" | ||
gh issue edit ${issue_number} --add-label "${add_label}" --remove-label "${remove_labels}" | ||
env: | ||
GH_TOKEN: ${{ inputs.token }} | ||
ISSUE_NUMBER: ${{ inputs.issue_number }} | ||
INSTANCE_STATUS: | ||
${{ steps.get_instance_status.outputs.instance_status }} |
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