File: FixPR.yml

package info (click to toggle)
rust-coreutils 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 485,976 kB
  • sloc: ansic: 103,608; asm: 28,570; sh: 8,672; python: 5,662; makefile: 474; cpp: 97; javascript: 72
file content (79 lines) | stat: -rw-r--r-- 3,009 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: FixPR

# spell-checker:ignore Swatinem dtolnay dedupe

# Trigger automated fixes for PRs being merged (with associated commits)

env:
  BRANCH_TARGET: main

on:
  # * only trigger on pull request closed to specific branches
  # ref: https://github.community/t/trigger-workflow-only-on-pull-request-merge/17359/9
  pull_request:
    branches:
      - main # == env.BRANCH_TARGET ## unfortunately, env context variables are only available in jobs/steps (see <https://github.community/t/how-to-use-env-context/16975/2>)
    types: [ closed ]

jobs:
  code_deps:
    # Refresh dependencies (ie, 'Cargo.lock') and show updated dependency tree
    if: github.event.pull_request.merged == true ## only for PR merges
    name: Update/dependencies
    runs-on: ${{ matrix.job.os }}
    strategy:
      matrix:
        job:
          - { os: ubuntu-latest , features: feat_os_unix }
    steps:
    - uses: actions/checkout@v6
      with:
        persist-credentials: false
    - name: Initialize job variables
      id: vars
      shell: bash
      run: |
        # surface MSRV from CICD workflow
        RUST_MIN_SRV=$(grep -P "^\s+RUST_MIN_SRV:" .github/workflows/CICD.yml | grep -Po "(?<=\x22)\d+[.]\d+(?:[.]\d+)?(?=\x22)" )
        echo "RUST_MIN_SRV=${RUST_MIN_SRV}" >> $GITHUB_OUTPUT
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ steps.vars.outputs.RUST_MIN_SRV }}
    - uses: Swatinem/rust-cache@v2
    - name: Ensure updated 'Cargo.lock'
      shell: bash
      run: |
        # Ensure updated '*/Cargo.lock'
        # * '*/Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
        for dir in "." "fuzz"; do
          ( cd "$dir" && (cargo fetch --locked --quiet --target $(rustc --print host-tuple) || cargo +${{ steps.vars.outputs.RUST_MIN_SRV }} update) )
        done
    - name: Info
      shell: bash
      run: |
        # Info
        ## environment
        echo "## environment"
        echo "CI='${CI}'"
        ## tooling info display
        echo "## tooling"
        which gcc >/dev/null 2>&1 && (gcc --version | head -1) || true
        rustup -V 2>/dev/null
        rustup show active-toolchain
        cargo -V
        rustc -V
        cargo tree -V
        ## dependencies
        echo "## dependency list"
        cargo fetch --locked --quiet --target $(rustc --print host-tuple)
        ## * using the 'stable' toolchain is necessary to avoid "unexpected '--filter-platform'" errors
        cargo +stable tree --locked --no-dedupe -e=no-dev --prefix=none --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique
    - name: Commit any changes (to '${{ env.BRANCH_TARGET }}')
      uses: EndBug/add-and-commit@v9
      with:
        new_branch: ${{ env.BRANCH_TARGET }}
        default_author: github_actions
        message: "maint ~ refresh 'Cargo.lock' 'fuzz/Cargo.lock'"
        add: Cargo.lock fuzz/Cargo.lock
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}