chore(deps): update taiki-e/install-action digest to ec9269c #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Format PR with dprint | |
on: | |
pull_request: | |
types: [labeled] | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
pr-fmt: | |
if: ${{ github.event.label.name == 'S-fmt' && github.repository_owner == 'rustic-rs' }} | |
name: Format PR | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.base.sha }} | |
- name: Install dprint | |
shell: bash | |
run: | | |
curl -fsSL https://dprint.dev/install.sh | sh | |
echo "/home/runner/.dprint/bin" >> $GITHUB_PATH | |
- name: Format PR | |
shell: bash | |
run: ~/.dprint/bin/dprint fmt | |
- name: Commit changes | |
shell: bash | |
run: | | |
git config --local user.name github-actions | |
git config --local user.email github-actions@github.com | |
git add . | |
git commit -m "Format PR" | |
git push | |
remove-fmt-label: | |
name: Remove fmt label | |
needs: pr-fmt | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
if: | | |
always() && | |
! contains(needs.*.result, 'skipped') && | |
github.repository_owner == 'rustic-rs' | |
steps: | |
- name: Remove label | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api \ | |
--method DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/S-fmt |