add /style and /swig magic comments #1
Workflow file for this run
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: 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 |