mirror of
https://github.com/gradle/actions.git
synced 2025-04-21 18:29:18 +08:00
Add PR triggers
This commit is contained in:
parent
1de476c015
commit
1ddf62bd9e
1
.github/workflows/ci-check-and-unit-test.yml
vendored
1
.github/workflows/ci-check-and-unit-test.yml
vendored
@ -2,6 +2,7 @@ name: CI-check-and-unit-test
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -9,6 +9,9 @@ on:
|
||||
- 'release/**'
|
||||
paths:
|
||||
- 'dist/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'dist/**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
11
.github/workflows/ci-init-script-check.yml
vendored
11
.github/workflows/ci-init-script-check.yml
vendored
@ -3,9 +3,14 @@ name: CI-init-script-check
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/ci-init-script-check.yml'
|
||||
- 'sources/src/resources/init-scripts/**'
|
||||
- 'sources/test/init-scripts/**'
|
||||
- '.github/workflows/ci-init-script-check.yml'
|
||||
- 'sources/src/resources/init-scripts/**'
|
||||
- 'sources/test/init-scripts/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/ci-init-script-check.yml'
|
||||
- 'sources/src/resources/init-scripts/**'
|
||||
- 'sources/test/init-scripts/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
52
.github/workflows/ci-integ-test.yml
vendored
52
.github/workflows/ci-integ-test.yml
vendored
@ -3,11 +3,13 @@ name: CI-integ-test
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
determine-suite:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
suite: ${{ steps.determine-suite.outputs.suite }}
|
||||
runner-os: ${{ steps.determine-suite.outputs.suite == 'quick' && '["ubuntu-latest"]' || '["ubuntu-latest", "windows-latest", "macos-latest"]' }}
|
||||
cache-key-prefix: ${{ steps.determine-suite.outputs.suite == 'quick' && '0' || github.run_number }}
|
||||
steps:
|
||||
@ -27,21 +29,61 @@ jobs:
|
||||
|
||||
# Always run quick suite for dependabot PRs
|
||||
if [ "${{ github.actor }}" == "dependabot[bot]" ]; then
|
||||
echo "Dependabot: suite=quick"
|
||||
echo "Dependabot PR: suite=quick"
|
||||
echo "suite=quick" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run full suite for PRs
|
||||
# Run quick suite for pushes with no associated PR
|
||||
if [ "${{ steps.PR.outputs.pr_found }}" == "false" ]; then
|
||||
echo "PR not found: suite=quick"
|
||||
echo "Push with no associated PR: suite=quick"
|
||||
echo "suite=quick" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "PR found: suite=full"
|
||||
echo "suite=full" >> "$GITHUB_OUTPUT"
|
||||
# When there's an associated PR, run full suite for pull_request trigger. Skip tests for push trigger.
|
||||
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
||||
echo "Pull request trigger: suite=full"
|
||||
echo "suite=full" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "Push with associated PR: suite=skip"
|
||||
echo "suite=skip" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
fi
|
||||
- name: Duplicate in script
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
env:
|
||||
PR_FOUND: ${{ steps.PR.outputs.pr_found }}
|
||||
script: |
|
||||
// Always run quick suite if we are not in the core `gradle/actions` repository
|
||||
// This reduces the load for developers working on forks
|
||||
if (github.repo.repo !== 'gradle/actions') {
|
||||
console.log('Not in core repository: suite=quick')
|
||||
return 'quick'
|
||||
}
|
||||
|
||||
// Always run quick suite for dependabot PRs
|
||||
if (github.actor === 'dependabot[bot]') {
|
||||
console.log('Dependabot PR: suite=quick')
|
||||
return 'quick'
|
||||
}
|
||||
|
||||
// Run quick suite for pushes with no associated PR
|
||||
if (process.env.PR_FOUND === 'false') {
|
||||
console.log('Push with no associated PR: suite=quick')
|
||||
return 'quick'
|
||||
} else {
|
||||
// When there's an associated PR, run full suite for pull_request trigger. Skip tests for push trigger.
|
||||
if (github.context.eventName === 'pull_request') {
|
||||
console.log('Pull request trigger: suite=full')
|
||||
return 'full'
|
||||
} else {
|
||||
console.log('Push with associated PR: suite=skip')
|
||||
return 'skip'
|
||||
}
|
||||
}
|
||||
|
||||
build-distribution:
|
||||
if: ${{ needs.determine-suite.outputs.suite != 'skip' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
|
Loading…
x
Reference in New Issue
Block a user