ci: Add nightly build status check and synchronize event to CI workflows (#5241)
* ci: add synchronize event to PR label workflow * feat: add nightly build status check to CI workflow * ci: rename job to 'Check Nightly Status' in CI workflow
This commit is contained in:
parent
67892d4292
commit
5a4aef0f82
2 changed files with 35 additions and 2 deletions
35
.github/workflows/ci.yml
vendored
35
.github/workflows/ci.yml
vendored
|
|
@ -45,17 +45,50 @@ concurrency:
|
|||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check-nightly-status:
|
||||
name: Check Nightly Status
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should-proceed: ${{ steps.check-workflow.outputs.success }}
|
||||
steps:
|
||||
- name: Check nightly workflow status
|
||||
id: check-workflow
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const workflow_name = 'nightly_build.yml';
|
||||
const { data: runs } = await github.rest.actions.listWorkflowRuns({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: workflow_name,
|
||||
per_page: 1,
|
||||
status: 'completed'
|
||||
});
|
||||
|
||||
if (runs.workflow_runs.length === 0) {
|
||||
console.log('No completed workflow runs found');
|
||||
return core.setOutput('success', 'true');
|
||||
}
|
||||
|
||||
const lastRun = runs.workflow_runs[0];
|
||||
const success = lastRun.conclusion === 'success';
|
||||
console.log(`Last nightly build status: ${lastRun.conclusion}`);
|
||||
core.setOutput('success', success.toString());
|
||||
|
||||
set-ci-condition:
|
||||
needs: check-nightly-status
|
||||
name: Should Run CI
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should-run-ci: ${{ (contains( github.event.pull_request.labels.*.name, 'lgtm') && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') }}
|
||||
should-run-ci: ${{ (needs.check-nightly-status.outputs.should-proceed == 'true') && ((contains( github.event.pull_request.labels.*.name, 'lgtm') && github.event.pull_request.draft == false) || (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call')) }}
|
||||
steps:
|
||||
# Do anything just to make the job run
|
||||
- run: echo "Debug CI Condition"
|
||||
- run: echo "Labels -> ${{ join(github.event.pull_request.labels.*.name, ',') }}"
|
||||
- run: echo "IsDraft -> ${{ github.event.pull_request.draft }}"
|
||||
- run: echo "Event name -> ${{ github.event_name }}"
|
||||
- run: echo "Nightly build status -> ${{ needs.check-nightly-status.outputs.should-proceed }}"
|
||||
|
||||
path-filter:
|
||||
needs: set-ci-condition
|
||||
if: ${{ needs.set-ci-condition.outputs.should-run-ci == 'true' }}
|
||||
|
|
|
|||
2
.github/workflows/conventional-labels.yml
vendored
2
.github/workflows/conventional-labels.yml
vendored
|
|
@ -3,7 +3,7 @@
|
|||
name: Label PRs with Conventional Commits
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited]
|
||||
types: [opened, edited, synchronize]
|
||||
|
||||
jobs:
|
||||
validate-pr:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue