diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..37a2190 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,5 @@ +changelog-updated: + - CHANGELOG.md + +msrv-updated: + - .github/assets/msrv-badge.svg diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c4e930..e6bb345 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,71 +38,6 @@ jobs: - uses: Swatinem/rust-cache@v1 - name: cargo check - ${{ matrix.cargo_checks.name }} run: cargo ${{ matrix.cargo_checks.subcommand }} - #generate_changelog: - # name: Generate changelog - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - # with: - # fetch-depth: 0 - # - name: Install Rust - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # profile: minimal - # override: true - # - uses: Swatinem/rust-cache@v1 - # with: - # key: changelog - # - name: Generate a changelog - # uses: orhun/git-cliff-action@v1 - # id: git-cliff - # with: - # config: cliff.toml - # args: --verbose - # env: - # OUTPUT: CHANGELOG-generated.md - # - name: Print the changelog - # run: cat "${{ steps.git-cliff.outputs.changelog }}" - # - name: Upload generated CHANGELOG - # uses: actions/upload-artifact@v2 - # with: - # name: CHANGELOG-generated - # path: CHANGELOG-generated.md - # retention-days: 1 - - #commit_changelog: - # name: Commit changelog - # #if: github.event_name == 'push' && github.ref == 'refs/heads/staging' - # needs: - # - ci - # - generate_changelog - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - # with: - # fetch-depth: 0 - # - name: Git branch name - # id: git-branch-name - # uses: EthanSK/git-branch-name-action@v1 - # - name: Echo the branch name - # run: echo "Branch name ${GIT_BRANCH_NAME}" - # - name: Download generated CHANGELOG - # uses: actions/download-artifact@v2 - # with: - # name: CHANGELOG-generated - # path: /tmp - # - name: Copy over changelog - # run: cp /tmp/CHANGELOG-generated.md CHANGELOG.md - # - uses: EndBug/add-and-commit@v9 - # with: - # add: CHANGELOG.md - # new_branch: ${{ env.GIT_BRANCH_NAME }} - # #new_branch: staging - # default_author: github_actions - # message: "[skip ci] Update CHANGELOG from Github Actions" update-project-stuff: if: github.event_name == 'push' && github.ref == 'refs/heads/staging' diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/triage_pr.yml similarity index 55% rename from .github/workflows/lint_pr.yml rename to .github/workflows/triage_pr.yml index 84ce774..eecc263 100644 --- a/.github/workflows/lint_pr.yml +++ b/.github/workflows/triage_pr.yml @@ -1,4 +1,4 @@ -name: "Lint PR" +name: "Triage PR" on: pull_request_target: @@ -8,7 +8,7 @@ on: - synchronize jobs: - main: + validate_pr_title: name: Validate PR title runs-on: ubuntu-latest steps: @@ -19,3 +19,14 @@ jobs: ignoreLabels: | bot-updated ignore-semantic-pull-request + label_pr: + name: Label Pull Request + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true diff --git a/.github/workflows/update-repo-stuff.yml b/.github/workflows/update-repo-stuff.yml index 92dad6c..3193633 100644 --- a/.github/workflows/update-repo-stuff.yml +++ b/.github/workflows/update-repo-stuff.yml @@ -7,7 +7,7 @@ env: CHANGELOG_FILENAME: CHANGELOG.md DEFAULT_BRANCH: main ADD_PR_LABELS: bot-updated - RESTART_PR_DELAY: 15s + RESTART_PR_DELAY: 30s GIT_BOT_USERNAME: github-actions[bot] GIT_BOT_EMAIL: github-actions[bot]@users.noreply.github.com @@ -169,7 +169,7 @@ jobs: needs: - bot-label-check - get_pr_info - if: ${{ needs.bot-label-check.outputs.label-exists }} + if: ${{ ! needs.bot-label-check.outputs.label-exists }} steps: - name: Checkout uses: actions/checkout@v3 @@ -222,7 +222,7 @@ jobs: name: Generate Minimum Supported Rust Version badge #if: github.event_name == 'push' && github.ref == 'refs/heads/staging' needs: bot-label-check - if: ${{ needs.bot-label-check.outputs.label-exists }} + if: ${{ ! needs.bot-label-check.outputs.label-exists }} runs-on: ubuntu-latest steps: - name: Checkout @@ -237,13 +237,11 @@ jobs: - name: Install cargo-msrv run: cargo install cargo-msrv - # I took this from entrypoint.sh - # from spenserblack/actions-msrv@v0.2 - name: Get Minimum Supported Rust Version id: get-msrv - timeout-minutes: 60 + timeout-minutes: 10 run: | - MSRV_RESULT=$(cargo msrv --path $1 --output-format json | tail -1) + MSRV_RESULT=$(cargo msrv --output-format json | tail -1) MSRV=$(echo $MSRV_RESULT | jq -r '.msrv') echo "::set-output name=msrv::$MSRV" @@ -263,7 +261,7 @@ jobs: - generate_changelog - generate_msrv - bot-label-check - if: ${{ needs.bot-label-check.outputs.label-exists }} + if: ${{ ! needs.bot-label-check.outputs.label-exists }} permissions: contents: write pull-requests: write @@ -326,7 +324,6 @@ jobs: env: GH_TOKEN: ${{ steps.app.outputs.token }} run: | - printf "Changelog and/or MSRV badge was updated.\n\nBors will cancel job, but no action is required. Job will be restarted." | gh pr comment ${{ needs.get_pr_info.outputs.pr_number }} --body-file - sleep ${{ env.RESTART_PR_DELAY }} gh pr edit ${{ needs.get_pr_info.outputs.pr_number }} --add-label ${{ env.ADD_PR_LABELS }}