SNOW-2688693: The write_pandas function returns invalid value [?] for parameter 'ON_ERROR' instead of actual errors
#4081
This file contains hidden or 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
| name: Jira creation | |
| on: | |
| issues: | |
| types: [opened] | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| create-issue: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| 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]')) | |
| steps: | |
| - name: Create JIRA Ticket | |
| id: create | |
| env: | |
| JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | |
| JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | |
| JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| ISSUE_BODY: ${{ github.event.issue.body }} | |
| ISSUE_URL: ${{ github.event.issue.html_url }} | |
| run: | | |
| # debug | |
| set -x | |
| TMP_BODY=$(mktemp) | |
| trap "rm -f $TMP_BODY" EXIT | |
| # Escape special characters in title and body | |
| TITLE=$(echo "${ISSUE_TITLE//`/\\`}" | sed 's/"/\\"/g' | sed "s/'/\\\'/g") | |
| echo "${ISSUE_BODY//`/\\`}" | sed 's/"/\\"/g' | sed "s/'/\\\'/g" > $TMP_BODY | |
| echo -e "\n\n_Created from GitHub Action_ for $ISSUE_URL" >> $TMP_BODY | |
| BODY=$(cat "$TMP_BODY") | |
| PAYLOAD=$(jq -n \ | |
| --arg issuetitle "$TITLE" \ | |
| --arg issuebody "$BODY" \ | |
| '{ | |
| fields: { | |
| project: { key: "SNOW" }, | |
| issuetype: { name: "Bug" }, | |
| summary: $issuetitle, | |
| description: $issuebody, | |
| customfield_11401: { id: "14723" }, | |
| assignee: { id: "712020:e527ae71-55cc-4e02-9217-1ca4ca8028a2" }, | |
| components: [{ id: "16413" }], | |
| labels: ["oss"], | |
| priority: { id: "10001" } | |
| } | |
| }') | |
| # Create JIRA issue using REST API | |
| RESPONSE=$(curl -s -X POST \ | |
| -H "Content-Type: application/json" \ | |
| -H "Accept: application/json" \ | |
| -u "$JIRA_USER_EMAIL:$JIRA_API_TOKEN" \ | |
| "$JIRA_BASE_URL/rest/api/2/issue" \ | |
| -d "$PAYLOAD") | |
| # Extract JIRA issue key from response | |
| JIRA_KEY=$(echo "$RESPONSE" | jq -r '.key') | |
| if [ "$JIRA_KEY" = "null" ] || [ -z "$JIRA_KEY" ]; then | |
| echo "Failed to create JIRA issue" | |
| echo "Response: $RESPONSE" | |
| echo "Request payload: $PAYLOAD" | |
| exit 1 | |
| fi | |
| echo "Created JIRA issue: $JIRA_KEY" | |
| echo "jira_key=$JIRA_KEY" >> $GITHUB_OUTPUT | |
| - name: Update GitHub Issue | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPOSITORY: ${{ github.repository }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| JIRA_KEY: ${{ steps.create.outputs.jira_key }} | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| run: | | |
| TITLE=$(echo "${ISSUE_TITLE//`/\\`}" | sed 's/"/\\"/g' | sed "s/'/\\\'/g") | |
| PAYLOAD=$(jq -n \ | |
| --arg issuetitle "$TITLE" \ | |
| --arg jirakey "$JIRA_KEY" \ | |
| '{ | |
| title: ($jirakey + ": " + $issuetitle) | |
| }') | |
| # Update Github issue title with jira id | |
| curl -s \ | |
| -X PATCH \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| "https://api.github.com/repos/$REPOSITORY/issues/$ISSUE_NUMBER" \ | |
| -d "$PAYLOAD" | |
| if [ "$?" != 0 ]; then | |
| echo "Failed to update GH issue. Payload was:" | |
| echo "$PAYLOAD" | |
| exit 1 | |
| fi |