Skip to content

Commit 49ca968

Browse files
committed
Add PR Dependency check workflow
1 parent 4276853 commit 49ca968

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Check for Dependencies in PR
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
issues: read
8+
pull-requests: read
9+
10+
jobs:
11+
check_dependencies:
12+
runs-on: ubuntu-latest
13+
name: "Check GitHub Actions Dependencies"
14+
steps:
15+
- uses: gregsdennis/dependencies-action@v1.4.1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pull_request.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@ name: Pull request
22

33
permissions:
44
contents: read
5+
issues: read
6+
pull-requests: read
57

68
on:
79
pull_request:
8-
types: [opened, reopened, synchronize]
10+
types: [opened, edited, reopened, labeled, unlabeled, synchronize]
911

1012
jobs:
13+
github_actiion_pr_dependency_check:
14+
name: GitHub Action Dependency Check
15+
uses: ./.github/workflows/github_actions_dependencies.yml
16+
1117
tests_with_docker_embedded_swift:
1218
name: Test Embedded Swift SDKs
1319
uses: ./.github/workflows/swift_package_test.yml
20+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
1421
with:
1522
# Wasm
1623
enable_linux_checks: false
@@ -23,6 +30,7 @@ jobs:
2330
tests_with_docker:
2431
name: Test with Docker
2532
uses: ./.github/workflows/swift_package_test.yml
33+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
2634
with:
2735
# Linux
2836
linux_os_versions: '["jammy", "rhel-ubi9", "amazonlinux2"]'
@@ -46,6 +54,7 @@ jobs:
4654
tests_without_docker:
4755
name: Test without Docker
4856
uses: ./.github/workflows/swift_package_test.yml
57+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
4958
with:
5059
# Skip Linux which doesn't currently support docker-less workflow
5160
enable_linux_checks: false
@@ -67,6 +76,7 @@ jobs:
6776
tests_macos:
6877
name: Test
6978
uses: ./.github/workflows/swift_package_test.yml
79+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
7080
with:
7181
enable_linux_checks: false
7282
enable_windows_checks: false
@@ -79,6 +89,7 @@ jobs:
7989
build_tests_ios:
8090
name: Build iOS Tests
8191
uses: ./.github/workflows/swift_package_test.yml
92+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
8293
with:
8394
enable_linux_checks: false
8495
enable_windows_checks: false
@@ -91,6 +102,7 @@ jobs:
91102
soundness:
92103
name: Soundness
93104
uses: ./.github/workflows/soundness.yml
105+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
94106
with:
95107
api_breakage_check_enabled: false
96108
license_header_check_project_name: "Swift.org"

docs/pr-dependency-workflow.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# PR Dependency Workflow Documentation
2+
3+
## Overview
4+
5+
The [`github_actions_dependencies.yml`](.github/workflows/github_actions_dependencies.yml) workflow uses [a third party GitHub action](https://github.com/marketplace/actions/pr-dependency-check) to enforce PR dependencies.
6+
7+
At the time of writing, the GitHub action supported the following styles, for both issues and PRs.:
8+
9+
- Quick Link: `#5`
10+
- Partial Link: `gregsdennis/dependencies-action#5`
11+
- Partial URL: `gregsdennis/dependencies-action/pull/5`
12+
- Full URL: `https://github.com/gregsdennis/dependencies-action/pull/5`
13+
- Markdown: `[markdown link](https://github.com/gregsdennis/dependencies-action/pull/5)`
14+
15+
## Usage
16+
17+
Add the following to a `.yaml` file in your `.github/workflows` directory:
18+
19+
```
20+
name: Check for GitHub Actions Dependencies in PR
21+
22+
on:
23+
pull_request_target:
24+
types: [opened, edited, reopened, labeled, unlabeled, synchronize]
25+
26+
permissions:
27+
issues: read
28+
pull-requests: read
29+
30+
jobs:
31+
check_dependencies:
32+
uses: swiftlang/github-workflows/.github/workflows/github_actions_dependencies.yml.yml@<to-be-updated>
33+
```

0 commit comments

Comments
 (0)