Skip to content
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

Perform pre-check before running nightly #475

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,33 @@ on:

permissions:
contents: write
actions: read
actions: write

jobs:
check:
name: Pre-check
runs-on: 'ubuntu-latest'
steps:
- name: Get last run SHA
run: gh run list --limit 1 --workflow nightly.yml --json headSha --template "{{range .}}SHA={{.headSha}}{{end}}" --status completed --repo ${{ github.repository }} >> "$GITHUB_OUTPUT"
id: last_run
env:
GH_TOKEN: ${{ github.token }}

- name: Print
run: |
echo Last sha: ${{ steps.last_run.outputs.sha }}
echo Current: ${{ github.sha }}
echo Should cancel: ${{ steps.last_run.outputs.sha == github.sha }}
- if: ${{ steps.last_run.outputs.sha == github.sha }}
run: gh run cancel ${{ github.run_id }} --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ github.token }}

build:
name: Build
needs: [check]
uses: ./.github/workflows/reusable-build.yml
strategy:
fail-fast: false
Expand All @@ -23,7 +45,7 @@ jobs:

publish:
name: Package
needs: [build, build]
needs: [build]
runs-on: windows-latest
steps:
- name: Download artifacts
Expand Down
Loading