Skip to content

Commit

Permalink
try separate apply style job
Browse files Browse the repository at this point in the history
  • Loading branch information
balos1 committed Sep 23, 2024
1 parent 67baf0d commit 0634176
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/apply-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Apply Style

on:
pull_request:
workflow_dispatch:
issue_comment:
types: [created]

jobs:
pr_commented:
# This job only runs for pull request comments
name: PR comment
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- run: |
echo A comment on PR $NUMBER
env:
NUMBER: ${{ github.event.issue.number }}
apply-style:
if: startsWith(github.event.comment.body, '/style')
name: Apply Formatting to Source
runs-on: ubuntu-latest
steps:
# Checkout the GitHub created reference for the PR.
# The only way to do this is by using the "issue" number
# but that is really the PR number in this context.
# This is due to using an `issue_comment` event which
# is due to the GitHub Actions API that does not have
# a `pull_request_comment` event or something similar.
# This leaves us in a detached head state which is corrected
# in `apply-style/entrypoint.sh`
- name: Checkout pull request
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head

- name: Checkout the right git ref
run: ./.github/actions/apply-style/checkout.sh

- name: Download the git diff from format_check
uses: actions/download-artifact@v4
with:
name: format.patch

0 comments on commit 0634176

Please sign in to comment.