Skip to content

Commit

Permalink
workflow: Handle when a pull request does not contain qna.yaml (#1112)
Browse files Browse the repository at this point in the history
Some pull requests are not about skill or knowledge contributions. We
change to always upload an artifact so the insight workflow wont fail
because it cannot download the artifact. In the case were the PR does
not contain qna.yaml, we pass the pull request number 0 so the insight
workflow can avoid invoking the insight analysis.

Signed-off-by: BJ Hargrave <[email protected]>
  • Loading branch information
bjhargrave authored May 21, 2024
1 parent 081bcd7 commit f808a96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/insight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
echo "PULL_REQUEST_NUMBER=$(cat pull_request_number.txt)" >> "$GITHUB_ENV"
- name: "Invoke insight analysis handler"
if: ${{ fromJSON(env.PULL_REQUEST_NUMBER) != 0 }}
run: |
curl -X "POST" "https://pr-analysis-handler.1fuhf5gskmng.us-east.codeengine.appdomain.cloud/analyze-pr?pr_number=${PULL_REQUEST_NUMBER}&owner=${REPOSITORY_OWNER}&repo=${REPOSITORY_NAME}" -H "accept: application/json" -H "Authorization: Bearer ${ANALYSIS_TOKEN}"
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ jobs:
knowledge
- name: "Save Pull Request number"
if: ${{ (steps.changed-files.outputs.any_changed == 'true') && (github.event_name == 'pull_request') && (github.repository == 'instructlab/taxonomy') }}
if: ${{ (github.event_name == 'pull_request') && (github.repository == 'instructlab/taxonomy') }}
run: |
echo "${PULL_REQUEST_NUMBER}" > pull_request_number.txt
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
PULL_REQUEST_NUMBER: ${{ steps.changed-files.outputs.any_changed == 'true' && github.event.number || '0' }}

- name: "Upload Pull Request number"
if: ${{ (steps.changed-files.outputs.any_changed == 'true') && (github.event_name == 'pull_request') && (github.repository == 'instructlab/taxonomy') }}
if: ${{ (github.event_name == 'pull_request') && (github.repository == 'instructlab/taxonomy') }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: pull_request_number
Expand Down

0 comments on commit f808a96

Please sign in to comment.