Skip to content

Commit 8421eea

Browse files
authored
Merge pull request #1716 from vprashar2929/fix-job-flow
fix(ci): ensure independent execution of cleanup and status jobs
2 parents 9fc7c7c + 13d33ed commit 8421eea

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.github/workflows/mock_acpi.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,20 @@ jobs:
1919
- name: Get PR branch
2020
id: pr_branch
2121
uses: xt0rted/pull-request-comment-branch@v2
22+
23+
- name: Set ref and sha as outputs
24+
run: |
25+
echo "head_ref=${{ steps.pr_branch.outputs.head_ref }}" >> $GITHUB_ENV
26+
echo "head_sha=${{ steps.pr_branch.outputs.head_sha }}" >> $GITHUB_ENV
27+
2228
# Since `issue_comment` event workflow will not appear on the
2329
# pull request page, we need to set the status of the job
2430
# in order to attach it to the pull request itself
2531
set-status-pending:
2632
if: github.event.issue.pull_request && github.event.comment.body == '/test-acpi'
2733
name: Set job status as pending
2834
runs-on: ubuntu-latest
29-
needs: [fetch-branch-name]
35+
needs: fetch-branch-name
3036
steps:
3137
- name: Set job status as pending
3238
uses: myrotvorets/set-commit-status-action@master
@@ -91,15 +97,11 @@ jobs:
9197
echo "Launching Mock ACPI compose and running validator"
9298
ansible-playbook -vv -i inventory.yaml mock_acpi_playbook.yaml -e "pr_number=${{ github.event.issue.number }}"
9399
94-
- name: Set failure status if playbook failed
95-
if: steps.run-playbook.outcome == 'failure'
96-
run: echo "failure_status=true" >> $GITHUB_ENV
97-
98100
cleanup:
99101
if: github.event.issue.pull_request && github.event.comment.body == '/test-acpi'
100102
name: Cleanup
101103
runs-on: ubuntu-latest
102-
needs: create-runner
104+
needs: setup-runner
103105
steps:
104106
- name: delete runner
105107
uses: rootfs/metal-delete-action@main
@@ -125,12 +127,11 @@ jobs:
125127
if: github.event.issue.pull_request && github.event.comment.body == '/test-acpi'
126128
name: Set final status
127129
runs-on: ubuntu-latest
128-
needs: fetch-branch-name
129130
steps:
130131
- name: Set job status as ${{ job.status }}
131132
uses: myrotvorets/set-commit-status-action@master
132133
if: always()
133134
with:
134-
sha: ${{ needs.fetch-branch-name.outputs.head_sha }}
135+
sha: ${{ env.head_sha }}
135136
token: ${{ secrets.GITHUB_TOKEN }}
136137
status: ${{ job.status }}

0 commit comments

Comments
 (0)