mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
This ensures that complete uniformity in how the generation scripts are run. All dependencies and scripts are set up in the exact same way, each time. The old pregen_all script has been removed and moved into the composite action to ensure failed scripts will always fail the job.
106 lines
3.2 KiB
YAML
106 lines
3.2 KiB
YAML
name: Comment Commands
|
|
on:
|
|
issue_comment:
|
|
types: [ created ]
|
|
|
|
jobs:
|
|
format:
|
|
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/format')
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: React Rocket
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const {owner, repo} = context.issue
|
|
github.rest.reactions.createForIssueComment({
|
|
owner,
|
|
repo,
|
|
comment_id: context.payload.comment.id,
|
|
content: "rocket",
|
|
});
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}
|
|
- name: Fetch all history and metadata
|
|
run: |
|
|
git checkout -b pr
|
|
git branch -f main origin/main
|
|
- name: Checkout PR
|
|
run: |
|
|
gh pr checkout $NUMBER
|
|
env:
|
|
GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}"
|
|
NUMBER: ${{ github.event.issue.number }}
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 17
|
|
- name: Set up Go 1.15.x
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
cache: false
|
|
go-version: 1.15.x
|
|
id: go
|
|
- name: Install Buildifier
|
|
run: |
|
|
cd $(mktemp -d)
|
|
GO111MODULE=on go get github.com/bazelbuild/buildtools/buildifier@6.0.0
|
|
- name: Install wpiformat
|
|
run: pip3 install wpiformat==2024.50
|
|
- name: Run wpiformat
|
|
run: wpiformat
|
|
- name: Run spotlessApply
|
|
run: ./gradlew spotlessApply
|
|
- name: Run buildifier
|
|
run: buildifier -warnings all --lint=fix -r .
|
|
- name: Commit
|
|
run: |
|
|
# Set credentials
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
# Commit
|
|
git commit -am "Formatting fixes"
|
|
git push
|
|
|
|
pregen:
|
|
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/pregen')
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: React Rocket
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const {owner, repo} = context.issue
|
|
github.rest.reactions.createForIssueComment({
|
|
owner,
|
|
repo,
|
|
comment_id: context.payload.comment.id,
|
|
content: "rocket",
|
|
});
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}
|
|
- name: Checkout PR
|
|
run: |
|
|
gh pr checkout $NUMBER
|
|
env:
|
|
GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}"
|
|
NUMBER: ${{ github.event.issue.number }}
|
|
- name: Run pregen
|
|
uses: ./.github/actions/pregen
|
|
- name: Commit
|
|
run: |
|
|
# Set credentials
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
# Commit
|
|
git commit -am "Regenerate pregenerated files"
|
|
git push
|