Skip to content

Commit

Permalink
Merge branch 'v2' into ci/KIT-3466-2
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart authored Sep 6, 2024
2 parents 785ddcf + 1e221a4 commit 806bdb9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 27 deletions.
35 changes: 35 additions & 0 deletions .github/actions/confirm-build-ok/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Confirm build is valid'
description: 'Confirm build is valid'
inputs:
github-token:
description: The GitHub token
required: true
conclusion:
description: The conclusion of the check. failure or success
required: true
runs:
using: composite
steps:
- name: Add GitHub check
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
github-token: ${{ inputs.github-token }}
script: |
const conclusion = '${{ inputs.conclusion }}'; // Get the conclusion input
const commitSha =
context.eventName === 'pull_request' ?
context.payload.pull_request.head.sha
: context.eventName === 'merge_group' ?
context.payload.merge_group.head_sha
: context.sha;
const restOptions = {
owner: context.repo.owner,
repo: context.repo.repo,
sha: commitSha,
state: conclusion, // Use the conclusion input
description: `Build is a ${conclusion}`,
context: 'probot/conclusion',
};
github.rest.repos.createCommitStatus(restOptions)
47 changes: 20 additions & 27 deletions .github/workflows/prbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,20 @@ jobs:
- 'e2e-headless-ssr-test-pages-prod'
runs-on: ubuntu-latest
steps:
- run: |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Determine conclusion
run: |
success="${{ !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure')}}"
if [[ $success == "true" ]]; then
echo "Build is valid"
exit 0
echo "conclusion=success" >> "$GITHUB_OUTPUT"
else
echo "Build is invalid"
exit 1
echo "conclusion=failure" >> "$GITHUB_OUTPUT"
fi
id: determine-conclusion
- uses: ./.github/actions/confirm-build-ok
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ steps.determine-conclusion.outputs.conclusion }}
is-valid-merge-queue:
name: 'Confirm build is valid (merge group)'
if: ${{ always() && github.event_name == 'merge_group'}}
Expand All @@ -386,29 +391,17 @@ jobs:
- 'e2e-headless-ssr-test-pages-prod'
runs-on: ubuntu-latest
steps:
- run: |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Determine conclusion
run: |
success="${{ !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure')}}"
if [[ $success == "true" ]]; then
echo "Build is valid"
exit 0
else
echo "Build is invalid"
exit 1
fi
is-valid:
name: 'Confirm build is valid'
if: ${{ always() }}
needs:
- 'is-valid-pr'
- 'is-valid-merge-queue'
runs-on: ubuntu-latest
steps:
- run: |
success="${{ contains(needs.*.result, 'success')}}"
if [[ $success == "true" ]]; then
echo "Build is valid"
exit 0
echo "conclusion=success" >> "$GITHUB_OUTPUT"
else
echo "Build is invalid"
exit 1
echo "conclusion=failure" >> "$GITHUB_OUTPUT"
fi
id: determine-conclusion
- uses: ./.github/actions/confirm-build-ok
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ steps.determine-conclusion.outputs.conclusion }}

0 comments on commit 806bdb9

Please sign in to comment.