blob: 7f7bc62846a3ce3ade85b17a6f6cda6dbc62b84d [file]
name: Diff Check
on:
workflow_dispatch:
inputs:
clone_url:
description: 'Git url of a rustfmt fork to compare against the latest rustfmt'
required: true
branch_name:
description: 'Name of the feature branch on the forked repo'
required: true
language_edition:
description: 'Rust language `edition` used to parse code'
required: true
default: 2015
type: choice
options:
- 2015
- 2018
- 2021
- 2024
style_edition:
description: 'rustfmt `style_edition` used when formatting code.'
required: true
default: 2021
type: choice
options:
- 2021 # 2015, 2018, and 2021 are all formatted the same since `style_edition` was added between 2021 and 2024
- 2024
commit_hash:
description: 'Optional commit hash from the feature branch'
required: false
rustfmt_configs:
description: 'Optional comma separated list of rustfmt config options to pass when running the feature branch'
required: false
release_channel:
description: 'Configure which release channel to use when compiling rustfmt'
default: stable
type: choice
options:
- stable
- beta
- nightly
permissions:
contents: read
jobs:
diff_check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Build check_diff binary
working-directory: ./check_diff
run: cargo build --release --locked
- name: Run Diff Check
working-directory: ./check_diff
env:
CHECK_DIFF_LOG: info
GITHUB_EVENT_INPUTS_COMMIT_HASH: ${{ github.event.inputs.commit_hash }}
GITHUB_EVENT_INPUTS_RUSTFMT_CONFIGS: ${{ github.event.inputs.rustfmt_configs }}
GITHUB_EVENT_INPUTS_CLONE_URL: ${{ github.event.inputs.clone_url }}
GITHUB_EVENT_INPUTS_BRANCH_NAME: ${{ github.event.inputs.branch_name }}
GITHUB_EVENT_INPUTS_LANGUAGE_EDITION: ${{ github.event.inputs.language_edition }}
GITHUB_EVENT_INPUTS_STYLE_EDITION: ${{ github.event.inputs.style_edition }}
shell: bash
run: |
OPTIONS=""
if [[ -n "${GITHUB_EVENT_INPUTS_COMMIT_HASH}" ]]; then
OPTIONS+="--commit-hash ${GITHUB_EVENT_INPUTS_COMMIT_HASH} "
fi
if [[ -n "${GITHUB_EVENT_INPUTS_RUSTFMT_CONFIGS}" ]]; then
OPTIONS+="--rustfmt-config ${GITHUB_EVENT_INPUTS_RUSTFMT_CONFIGS} "
fi
target/release/check_diff ${GITHUB_EVENT_INPUTS_CLONE_URL} ${GITHUB_EVENT_INPUTS_BRANCH_NAME} \
--edition ${GITHUB_EVENT_INPUTS_LANGUAGE_EDITION} \
--style-edition ${GITHUB_EVENT_INPUTS_STYLE_EDITION} \
$OPTIONS