Skip to content

Commit

Permalink
fix dispatch checkout-branch (#1408)
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis authored Jan 8, 2024
2 parents 4da645b + a960b33 commit 2ed6726
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
required: false
type: string
description: Arguments to pass to `cargo xtask ci-job target-matrix`
checkout-ref:
required: false
type: string
description: Used to checkout a specific ref, instead of the default ref with `actions/checkout` action
pull_request:
merge_group:
push:
Expand All @@ -23,6 +27,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- name: Run ShellCheck
uses: azohra/[email protected]
Expand All @@ -31,12 +37,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: EmbarkStudios/cargo-deny-action@v1

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- uses: ./.github/actions/setup-rust
with:
Expand All @@ -55,6 +65,8 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- uses: ./.github/actions/setup-rust
with:
Expand All @@ -72,6 +84,8 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- uses: ./.github/actions/setup-rust
- uses: ./.github/actions/cargo-llvm-cov
Expand All @@ -87,6 +101,8 @@ jobs:
is-latest: ${{ steps.check.outputs.is-latest }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: ./.github/actions/setup-rust
- run: cargo xtask ci-job check
id: check
Expand All @@ -96,6 +112,8 @@ jobs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: ./.github/actions/setup-rust

- name: Generate matrix
Expand All @@ -122,6 +140,8 @@ jobs:
coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- uses: ./.github/actions/setup-rust

Expand Down Expand Up @@ -238,6 +258,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: ./.github/actions/setup-rust

- name: LLVM instrument coverage
Expand All @@ -256,6 +278,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: ./.github/actions/setup-rust

- name: LLVM instrument coverage
Expand All @@ -274,6 +298,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: ./.github/actions/setup-rust

- name: LLVM instrument coverage
Expand All @@ -298,6 +324,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: ./.github/actions/setup-rust

- name: LLVM instrument coverage
Expand Down Expand Up @@ -325,6 +353,8 @@ jobs:
coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}

- uses: ./.github/actions/setup-rust

Expand Down Expand Up @@ -356,6 +386,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: ./.github/actions/setup-rust
- uses: ./.github/actions/cargo-publish
with:
Expand Down Expand Up @@ -384,6 +416,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
- uses: ./.github/actions/setup-rust
- uses: actions/download-artifact@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/try.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
uses: ./.github/workflows/ci.yml
with:
matrix-args: try --comment "${{ github.event.comment.body }}" --pr ${{ github.event.issue.number }}
checkout-ref: refs/pull/${{ github.event.issue.number }}/head
comment:
needs: try
if: always() && needs.try.result != 'skipped'
Expand All @@ -22,7 +23,7 @@ jobs:
run: |
PR_ID=${{ github.event.issue.number }}
gh run view ${{ github.run_id }} --json jobs |\
jq -r '"Diff for [comment]("+$comment+")\n\n- [Run](" + (.jobs[] | select(.name == "try / generate-matrix") | .url) + ")\n" + ([.jobs[] | select(.name | startswith("try / target")) | select(.name | contains("matrix.pretty") | not ) | "- [" + (.name | capture("\\((?<name>[^,]+),.*") | .name) + "](" + .url + "?pr=" + $pr_id + "#step:7:45)"] | join("\n"))' --arg pr_id "$PR_ID" --arg comment "${{ github.event.comment.url }}"|\
jq -r '"Diff for [comment]("+$comment+")\n\n- [Run](" + (.jobs[] | select(.name == "try / generate-matrix") | .url) + ")\n" + ([.jobs[] | select(.name | startswith("try / target")) | select(.name | contains("matrix.pretty") | not ) | "- [" + (.name | capture("\\((?<name>[^,]+),.*") | .name) + "](" + .url + "?pr=" + $pr_id + "#step:10:1)"] | join("\n"))' --arg pr_id "$PR_ID" --arg comment "${{ github.event.comment.url }}"|\
gh pr comment "$PR_ID" --body "$(< /dev/stdin)"
env:
GH_TOKEN: ${{ github.token }}
1 change: 1 addition & 0 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
uses: ./.github/workflows/ci.yml
with:
matrix-args: --weekly
checkout-ref: ${{ github.ref }}
wiki:
name: Ensure wiki is valid
runs-on: ubuntu-latest
Expand Down

0 comments on commit 2ed6726

Please sign in to comment.