2024-11-01 10:58:48 +00:00
|
|
|
name: Run Trunk Fmt on PR Comment
|
|
|
|
|
|
|
|
on:
|
|
|
|
issue_comment:
|
|
|
|
types: [created]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
trunk-fmt:
|
|
|
|
if: github.event.issue.pull_request != null && contains(github.event.comment.body, 'trunk fmt')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2024-11-01 11:10:42 +00:00
|
|
|
ref: ${{github.event.pull_request.head.ref}}
|
|
|
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
2024-11-01 10:58:48 +00:00
|
|
|
|
2024-11-01 11:04:14 +00:00
|
|
|
- name: Install trunk
|
|
|
|
run: curl https://get.trunk.io -fsSL | bash
|
2024-11-01 10:58:48 +00:00
|
|
|
|
|
|
|
- name: Run Trunk Fmt
|
|
|
|
run: trunk fmt
|
|
|
|
|
2025-01-09 02:43:24 +00:00
|
|
|
- name: Get release version string
|
|
|
|
run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
|
|
id: version
|
|
|
|
|
2024-11-01 10:58:48 +00:00
|
|
|
- name: Commit and push changes
|
|
|
|
run: |
|
|
|
|
git config --global user.name "github-actions[bot]"
|
|
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
git add .
|
2025-01-09 02:43:24 +00:00
|
|
|
git commit -m "Add firmware version ${{ steps.version.outputs.long }}"
|
2024-11-01 10:58:48 +00:00
|
|
|
git push
|
|
|
|
|
|
|
|
- name: Comment on PR
|
2024-11-01 12:50:40 +00:00
|
|
|
uses: actions/github-script@v7
|
2024-11-01 10:58:48 +00:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
script: |
|
|
|
|
github.issues.createComment({
|
|
|
|
issue_number: context.issue.number,
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
body: '`trunk fmt` has been run on this PR.'
|
|
|
|
})
|