-
Notifications
You must be signed in to change notification settings - Fork 135
SNOW-2069227: Update Jira workflows #3699
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
base: main
Are you sure you want to change the base?
Conversation
Fix indentation and formatting issues in the Jira close workflow.
curl -X POST \ | ||
--url "$JIRA_API_URL" \ | ||
--user "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" \ | ||
--header "Content-Type: application/json" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line continuation backslashes in the curl commands have trailing spaces, which will cause the commands to fail in bash. For proper line continuation, remove the spaces after each backslash:
curl -X POST \
--url "$JIRA_API_URL" \
--user "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" \
--header "Content-Type: application/json" \
This issue appears in both workflow files. All backslashes used for line continuation should have no trailing spaces.
curl -X POST \ | |
--url "$JIRA_API_URL" \ | |
--user "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" \ | |
--header "Content-Type: application/json" \ | |
curl -X POST \ | |
--url "$JIRA_API_URL" \ | |
--user "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" \ | |
--header "Content-Type: application/json" \ |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
TITLE=$(echo '${{ github.event.issue.title }}' | sed 's/"/\"/g' | sed "s/'/\'/g") | ||
BODY=$(echo '${{ github.event.issue.body }}' | sed 's/"/\"/g' | sed "s/'/\'/g") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current sed commands for escaping special characters won't properly handle all JSON escape sequences needed for the API request. For more robust JSON escaping, consider using jq
:
TITLE=$(echo '${{ github.event.issue.title }}' | jq -R -s .)
BODY=$(echo '${{ github.event.issue.body }}' | jq -R -s .)
This approach will properly escape all special characters according to JSON standards, preventing potential API errors when the title or body contains quotes, newlines, or other special characters.
TITLE=$(echo '${{ github.event.issue.title }}' | sed 's/"/\"/g' | sed "s/'/\'/g") | |
BODY=$(echo '${{ github.event.issue.body }}' | sed 's/"/\"/g' | sed "s/'/\'/g") | |
TITLE=$(echo '${{ github.event.issue.title }}' | jq -R -s .) | |
BODY=$(echo '${{ github.event.issue.body }}' | jq -R -s .) |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
permissions: | ||
issues: write | ||
if: (github.event_name == 'issues' && github.event.pull_request.user.login != 'whitesource-for-github-com[bot]') | ||
if: ((github.event_name == 'issue_comment' && github.event.comment.body == 'recreate jira' && github.event.comment.user.login == 'sfc-gh-mkeller') || (github.event_name == 'issues' && github.event.pull_request.user.login != 'whitesource-for-github-com[bot]')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be an issue with the conditional check for issue events. The property github.event.pull_request.user.login
is being referenced, but issue events don't have a pull_request
property. This should be changed to github.event.issue.user.login
instead to correctly filter based on the issue creator.
if: ((github.event_name == 'issue_comment' && github.event.comment.body == 'recreate jira' && github.event.comment.user.login == 'sfc-gh-mkeller') || (github.event_name == 'issues' && github.event.pull_request.user.login != 'whitesource-for-github-com[bot]')) | |
if: ((github.event_name == 'issue_comment' && github.event.comment.body == 'recreate jira' && github.event.comment.user.login == 'sfc-gh-mkeller') || (github.event_name == 'issues' && github.event.issue.user.login != 'whitesource-for-github-com[bot]')) |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-NNNNNNN
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.
This PR updates the Jira workflows (.github/workflows/jira_close.yml, .github/workflows/jira_issue.yml) to use curl. Atlassian marketplace actions are deprecated and we also want to remove dependency on another repo.