Skip to content

Commit

Permalink
ci: Improve diagnostics in PR workflows (#2778)
Browse files Browse the repository at this point in the history
  • Loading branch information
olix0r authored Mar 12, 2024
1 parent eccce3c commit 7b5c173
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: changed
uses: tj-actions/changed-files@800a2825992141ddde1a8bca8ad394cec34d3188
with:
Expand Down
41 changes: 21 additions & 20 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: build
uses: tj-actions/changed-files@800a2825992141ddde1a8bca8ad394cec34d3188
with:
Expand All @@ -29,22 +30,17 @@ jobs:
files_ignore: 'Cargo.toml'
files: |
**/Cargo.toml
- id: cargo-crates
if: steps.cargo.outputs.any_changed == 'true'
run: ./.github/list-crates.sh ${{ steps.cargo.outputs.all_changed_files }}
- id: rust
uses: tj-actions/changed-files@800a2825992141ddde1a8bca8ad394cec34d3188
with:
files: |
**/*.rs
Cargo.lock
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: cargo-crates
if: steps.cargo.outputs.any_changed
run: ./.github/list-crates.sh ${{ steps.cargo.outputs.all_changed_files }}
- run: |
echo 'build: ${{ steps.build.outputs.all_changed_files }}'
echo 'cargo: ${{ steps.cargo.outputs.all_changed_files }}'
echo 'crates: ${{ steps.cargo-crates.outputs.crates }}'
echo 'rust: ${{ steps.rust.outputs.all_changed_files }}'
outputs:
is_dependabot: ${{ github.actor == 'dependabot[bot]' && 'true' || '' }}
any_changed: ${{ steps.build.outputs.any_changed || steps.cargo.outputs.any_changed || steps.rust.outputs.any_changed }}
build_changed: ${{ steps.build.outputs.any_changed }}
cargo_changed: ${{ steps.cargo.outputs.any_changed }}
Expand All @@ -63,7 +59,7 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- run: git config --global --add safe.directory "$PWD" # actions/runner#2033
- run: just fetch
- name: cargo deny check bans licenses sources
- name: Run cargo deny check bans licenses sources
uses: EmbarkStudios/cargo-deny-action@64015a69ee7ee08f6c56455089cdaf6ad974fd15
with:
command: check bans licenses sources
Expand Down Expand Up @@ -114,29 +110,34 @@ jobs:

ok:
timeout-minutes: 3
needs: [rust, rust-crates, linkerd-install]
needs: [meta, rust, rust-crates, linkerd-install]
if: always()
runs-on: ubuntu-latest
steps:
- name: Info
run: |
echo 'Actor: ${{ github.actor }}'
echo 'Event: ${{ github.event_name }}'
echo 'Rust: ${{ needs.rust.result }}'
echo 'Crates: ${{ needs.rust-crates.result }}'
echo 'Install: ${{ needs.linkerd-install.result }}'
echo 'github.actor: ${{ github.actor }}'
echo 'github.event_name: ${{ github.event_name }}'
echo 'github.event.pull_request.number: ${{ github.event.pull_request.number }}'
echo 'needs.rust.result: ${{ needs.rust.result }}'
echo 'needs.rust-crates.result: ${{ needs.rust-crates.result }}'
echo 'needs.linkerd-install.result: ${{ needs.linkerd-install.result }}'
echo 'needs.meta.outputs.is_dependabot: ${{ needs.meta.outputs.is_dependabot }}'
echo 'needs.meta.outputs.any_changed: ${{ needs.meta.outputs.any_changed }}'
echo 'needs.meta.outputs.cargo_changed: ${{ needs.meta.outputs.cargo_changed }}'
echo 'needs.meta.outputs.cargo_crates: ${{ needs.meta.outputs.cargo_crates }}'
echo 'needs.meta.outputs.rust_changed: ${{ needs.meta.outputs.rust_changed }}'
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1

auto-merge:
needs: ok
if: github.actor == 'dependabot[bot]'
needs: [meta, ok]
if: needs.meta.outputs.is_dependabot == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- run: gh pr merge '${{ github.event.pull_request.number }}' --auto --merge
- run: gh pr merge '${{ github.event.pull_request.number }}' --auto --squash
env:
GH_TOKEN: ${{ github.token }}

0 comments on commit 7b5c173

Please sign in to comment.