-
Notifications
You must be signed in to change notification settings - Fork 24
ci: update status when action triggered by issue comment #263
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,23 +90,25 @@ jobs: | |
| ANSIBLE_INJECT_FACT_VARS: "false" | ||
|
|
||
| steps: | ||
| - name: Get PR head SHA | ||
| - name: Get PR head SHA and context | ||
| if: github.event_name == 'issue_comment' | ||
| id: head_sha | ||
| id: head_sha_context | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| REPO: ${{ github.repository }} | ||
| PR_NUMBER: ${{ github.event.issue.number }} | ||
| CONTEXT: "${{ github.workflow }} / scenario (${{ matrix.scenario.image }}, ${{ matrix.scenario.env }}) (pull_request)" | ||
| run: | | ||
| set -euxo pipefail | ||
| head_sha=$(gh api "repos/$REPO/pulls/$PR_NUMBER" --jq '.head.sha') | ||
| echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT" | ||
| echo "context=$CONTEXT" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Checkout repo | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | ||
| with: | ||
| persist-credentials: false | ||
| ref: ${{ steps.head_sha.outputs.head_sha || github.sha }} | ||
| ref: ${{ steps.head_sha_context.outputs.head_sha || github.sha }} | ||
|
|
||
| - name: Check if platform is supported | ||
| id: check_platform | ||
|
|
@@ -144,6 +146,16 @@ jobs: | |
|
|
||
| echo "supported=$supported" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Set commit status as pending | ||
| if: github.event_name == 'issue_comment' && steps.check_platform.outputs.supported | ||
| uses: myrotvorets/set-commit-status-action@c0f880c99d91381c6fdb97726f03feb8004409b4 # master | ||
| with: | ||
| sha: ${{ steps.head_sha_context.outputs.head_sha }} | ||
| status: pending | ||
| context: ${{ steps.head_sha_context.outputs.context }} | ||
| description: Test started | ||
| targetUrl: "" | ||
|
|
||
| - name: Set up /dev/kvm | ||
| if: steps.check_platform.outputs.supported | ||
| run: | | ||
|
|
@@ -290,11 +302,22 @@ jobs: | |
| done | ||
| "${cmdline[@]}" | ||
|
|
||
| - name: Set final commit status | ||
| if: always() && github.event_name == 'issue_comment' && steps.head_sha_context.outputs.head_sha != '' && steps.check_platform.outputs.supported | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- workflow lines 240-325 ---'
sed -n '240,325p' .github/workflows/qemu-kvm-integration-tests.yml
printf '%s\n' '--- workflow status/platform references ---'
rg -n -C 4 "check_platform|supported|final|status|platform" .github/workflows/qemu-kvm-integration-tests.ymlRepository: linux-system-roles/postfix Length of output: 11601 🤖 get_repo_knowledge executed:
Length of output: 6212 Report failures from 🤖 Prompt for AI Agents |
||
| uses: myrotvorets/set-commit-status-action@c0f880c99d91381c6fdb97726f03feb8004409b4 # master | ||
| with: | ||
| sha: ${{ steps.head_sha_context.outputs.head_sha }} | ||
| status: ${{ job.status }} | ||
| context: ${{ steps.head_sha_context.outputs.context }} | ||
| description: Test finished | ||
| targetUrl: "" | ||
|
|
||
| - name: Set commit status as success with a description that platform is skipped | ||
| if: ${{ steps.check_platform.outputs.supported == '' }} | ||
| if: ${{ github.event_name == 'issue_comment' && steps.check_platform.outputs.supported == '' }} | ||
| uses: myrotvorets/set-commit-status-action@c0f880c99d91381c6fdb97726f03feb8004409b4 # master | ||
| with: | ||
| sha: ${{ steps.head_sha_context.outputs.head_sha }} | ||
| status: success | ||
| context: "${{ github.workflow }} / scenario (${{ matrix.scenario.image }}, ${{ matrix.scenario.env }}) (pull_request)" | ||
| context: ${{ steps.head_sha_context.outputs.context }} | ||
| description: The role does not support this platform. Skipping. | ||
| targetUrl: "" | ||
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Resolve PR context before setup steps.
If
Update pip, gitfails, GitHub skips the PR-context and pending-status steps. The final-status step also skips becausehead_shais empty. The issue-comment run then reports no status instead of failure..github/workflows/ansible-lint.yml#L82-L84: move PR-context resolution and pending status creation beforeUpdate pip, git..github/workflows/ansible-managed-var-comment.yml#L71-L73: move PR-context resolution and pending status creation beforeUpdate pip, git..github/workflows/ansible-test.yml#L85-L87: move PR-context resolution and pending status creation beforeUpdate pip, git.📍 Affects 3 files
.github/workflows/ansible-lint.yml#L82-L84(this comment).github/workflows/ansible-managed-var-comment.yml#L71-L73.github/workflows/ansible-test.yml#L85-L87🤖 Prompt for AI Agents