ci: set dynamic PR title based on runtime ecodes changes #5
This file contains hidden or 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: Generate Ecodes | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "scripts/generate-ecodes.lua" | |
| - ".github/workflows/generate-ecodes.yml" | |
| # Weekly run every Sunday at 00:00 UTC | |
| schedule: | |
| - cron: "0 0 * * 0" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Lua | |
| uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: "luajit" | |
| - name: Download latest input-event-codes.h | |
| run: curl -sSfL https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/input-event-codes.h -o input-event-codes.h | |
| - name: Run code generation script | |
| run: ./scripts/generate-ecodes.lua input-event-codes.h | |
| - name: Clean up temporary header | |
| run: rm input-event-codes.h | |
| - name: Determine PR type | |
| id: pr-type | |
| run: | | |
| if git diff --quiet HEAD src/evdev/ecodes.lua; then | |
| echo "title=chore(ecodes): auto-regenerate ecodes files" >> $GITHUB_OUTPUT | |
| else | |
| echo "title=feat(ecodes): update event codes to latest Linux kernel" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| commit-message: "${{ steps.pr-type.outputs.title }}" | |
| title: "${{ steps.pr-type.outputs.title }}" | |
| body: "Auto-generated changes by the `generate-ecodes` workflow." | |
| branch: "auto-generate-ecodes" |