Skip to content

feat: modify error handling in case of attribute error for db calls #19529

feat: modify error handling in case of attribute error for db calls

feat: modify error handling in case of attribute error for db calls #19529

Workflow file for this run

name: Approve PRs
on:
workflow_dispatch:
inputs:
user:
description: 'Username'
required: true
type: string
html_url:
description: 'URL to the comment'
required: true
type: string
pr:
description: 'Pull request to approve'
required: true
type: number
commentid:
description: 'Comment ID number'
type: number
required: true
issue_comment:
types: [created, edited]
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
autoapprove:
# This job only runs for pull request comments
name: PR comment
if: (github.event.issue.pull_request &&
contains(github.event.comment.body, '@pyansys-ci-bot LGTM') && (
github.event.comment.user.login == 'germa89'
)) || ( github.event_name == 'workflow_dispatch' )
permissions:
pull-requests: write # Needed to approve pull requests
runs-on: ubuntu-latest
steps:
- name: "Settings"
id: settings
env:
event_name: ${{ github.event_name }}
inputs_user: ${{ inputs.user }}
inputs_html_url: ${{ inputs.html_url }}
inputs_pr: ${{ inputs.pr }}
inputs_commentid: ${{ inputs.commentid }}
github_login: ${{ github.event.comment.user.login }}
github_html_url: ${{ github.event.comment.html_url }}
github_number: ${{ github.event.issue.number }}
github_id: ${{ github.event.comment.id }}
run: |
if [[ $event_name == "workflow_dispatch" ]] ; then
echo "On workflow dispatch"
echo "user=${inputs_user}" >> $GITHUB_OUTPUT
echo "html_url=${inputs_html_url}" >> $GITHUB_OUTPUT
echo "pull_request=${inputs_pr}" >> $GITHUB_OUTPUT
echo "commentid=${inputs_commentid}" >> $GITHUB_OUTPUT
else
echo "On $event_name"
echo "user=${github_login}" >> $GITHUB_OUTPUT
echo "html_url=${github_html_url}" >> $GITHUB_OUTPUT
echo "pull_request=${github_number}" >> $GITHUB_OUTPUT
echo "commentid=${github_id}" >> $GITHUB_OUTPUT
fi;
- name: React to comment
#https://github.com/ansys/pymapdl/pull/2654#issuecomment-1889009514
uses: dkershner6/reaction-action@97ede302a1b145b3739dec3ca84a489a34ef48b5 #v2.2.1
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
commentId: ${{ steps.settings.outputs.commentid }} # Optional if the trigger is a comment. Use another action to find this otherwise.
reaction: "+1" # Optional
- name: "Grab url for GIF"
id: image_grabber
run: |
sudo apt-get install jq
export IMG_MSG=$(curl -s 'https://us-central1-lgtm-reloaded.cloudfunctions.net/lgtm' | jq -r '.markdown' | grep -v 'Powered By GIPHY')
echo "IMG_MSG=$IMG_MSG" >> $GITHUB_OUTPUT
- uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 #v4.0.0
with:
review-message: |
:white_check_mark: Approving this PR because [${{ steps.settings.outputs.user }}](https://github.com/${{ steps.settings.outputs.user }}) said so in [here](${{ steps.settings.outputs.html_url }}) :grimacing:
${{ steps.image_grabber.outputs.IMG_MSG }}
pull-request-number: ${{ steps.settings.outputs.pull_request }}
github-token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}