Skip to content

Commit

Permalink
ci: Fix dependabot merge flow (#2781)
Browse files Browse the repository at this point in the history
Merge actions workflow into PR workflow
  • Loading branch information
olix0r authored Mar 12, 2024
1 parent 7466eb3 commit 62556c4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 34 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/actions.yml

This file was deleted.

37 changes: 29 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
.github/workflows/pr.yml
justfile
Dockerfile
- id: actions
uses: tj-actions/changed-files@800a2825992141ddde1a8bca8ad394cec34d3188
with:
files: |
.github/workflows/**
.devcontainer/*
- id: cargo
uses: tj-actions/changed-files@800a2825992141ddde1a8bca8ad394cec34d3188
with:
Expand All @@ -41,11 +47,12 @@ jobs:
Cargo.lock
outputs:
is_dependabot: ${{ github.actor == 'dependabot[bot]' }}
any_changed: ${{ steps.build.outputs.any_changed == 'true' || steps.cargo.outputs.any_change == 'true' || steps.rust.outputs.any_changed == 'true' }}
any_changed: ${{ steps.build.outputs.any_changed == 'true' || steps.actions.outputs.any_change == 'true' || steps.cargo.outputs.any_change == 'true' || steps.rust.outputs.any_changed == 'true' }}
build_changed: ${{ steps.build.outputs.any_changed }}
cargo_changed: ${{ steps.cargo.outputs.any_changed }}
cargo_crates: ${{ steps.cargo-crates.outputs.crates }}
rust_changed: ${{ steps.rust.outputs.any_changed }}
actions_changed: ${{ steps.build.outputs.any_changed == 'true' || steps.actions.outputs.any_changed == 'true' }}
cargo_changed: ${{ steps.cargo.outputs.any_changed == 'true' }}
cargo_crates: ${{ steps.cargo-crates.outputs.crates == 'true' }}
rust_changed: ${{ steps.build.outputs.any_changed == 'true' || steps.rust.outputs.any_changed == 'true' }}

info:
timeout-minutes: 3
Expand All @@ -59,13 +66,24 @@ jobs:
echo 'github.event.pull_request.number: ${{ github.event.pull_request.number }}'
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.actions_changed: ${{ needs.meta.outputs.actions_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 }}'
actions:
needs: meta
if: needs.meta.outputs.actions_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: linkerd/dev/actions/setup-tools@v43
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- run: just action-lint
- run: just action-dev-check

rust:
needs: meta
if: needs.meta.outputs.any_changed == 'true'
if: needs.meta.outputs.cargo_changed == 'true' || needs.meta.outputs.rust_changed == 'true'
runs-on: ubuntu-latest
container: ghcr.io/linkerd/dev:v43-rust
permissions:
Expand Down Expand Up @@ -102,7 +120,7 @@ jobs:

linkerd-install:
needs: meta
if: needs.meta.outputs.any_changed == 'true'
if: needs.meta.outputs.cargo_changed == 'true' || needs.meta.outputs.rust_changed == 'true'
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
Expand All @@ -124,9 +142,9 @@ jobs:
env:
TMPDIR: ${{ runner.temp }}

ok:
ship-it:
timeout-minutes: 3
needs: [meta, rust, rust-crates, linkerd-install]
needs: [meta, actions, rust, rust-crates, linkerd-install]
if: always()
runs-on: ubuntu-latest

Expand All @@ -137,6 +155,7 @@ jobs:
steps:
- name: Results
run: |
echo 'needs.actions.result: ${{ needs.rust.result }}'
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 }}'
Expand All @@ -146,6 +165,8 @@ jobs:
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
if: needs.meta.outputs.is_dependabot == 'true' && needs.meta.outputs.any_changed == 'true'
- name: 'Merge dependabot changes'
if: needs.meta.outputs.is_dependabot == 'true' && needs.meta.outputs.any_changed == 'true'
run: gh pr merge '${{ github.event.pull_request.number }}' --auto --squash
Expand Down

0 comments on commit 62556c4

Please sign in to comment.