Skip to content

Update system calls data and create PR #9

Update system calls data and create PR

Update system calls data and create PR #9

name: Update system calls data and create PR
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * 2' # Each tuesday
# also run on repo changes
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
update-tables:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
linux_version: ${{ steps.get_linux_version.outputs.linux_version }}
changes_detected: ${{ steps.check_syscalls_changes.outputs.changes_detected }}
steps:
- name: install packages data
run: sudo apt-get update
# without x32 headers we get i386 data for x32
- name: install x32 headers
run: sudo apt-get install libc6-dev-x32
- name: Checkout syscalls-table
uses: actions/checkout@v4
with:
path: syscalls-table/
ref: master
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Linux
uses: actions/checkout@v4
with:
path: linux
repository: torvalds/linux
- name: Update system calls data
working-directory: syscalls-table/
run: |
bash scripts/update-tables.sh $GITHUB_WORKSPACE/linux/
- name: Check linux version
id: get_linux_version
working-directory: linux/
run: |
LINUX_VER=$(make kernelversion)
echo "VERSION=$LINUX_VER" >> $GITHUB_ENV
echo "linux_version=$LINUX_VER" >> $GITHUB_OUTPUT
- name: Check for changes
id: check_syscalls_changes
working-directory: syscalls-table/
run: |
# Check for changes other than Linux kernel version change and export a flag
if git status --porcelain=v1 | grep -v system_calls/linux_version.py | grep -q '^\(M\|A\|D\)'; then
echo "changes_detected=true" >> $GITHUB_OUTPUT
else
echo "changes_detected=false" >> $GITHUB_OUTPUT
fi
- name: Upload changes as artifact
uses: actions/upload-artifact@v4
with:
name: updated-tables-data
path: syscalls-table/
retention-days: 1 # Only needed for the next job
create-pr:
name: Create PR for updating tables
runs-on: ubuntu-latest
needs:
- update-tables
# Run on schedule or manual run. If there are changes.
if: |
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') &&
needs.update-tables.outputs.changes_detected == 'true'
steps:
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
path: syscalls-table/
signoff: true
base: master
branch: update/tables
title: 'update syscalls tables for kernel ${{ needs.update-tables.outputs.linux_version }}'
body: |
This autogenerated PR updates the tables of syscalls from kernel ${{ needs.update-tables.outputs.linux_version }}. Do not edit this PR.
```
commit-message: 'update syscalls tables for kernel ${{ needs.update-tables.outputs.linux_version }}'
token: ${{ secrets.GITHUB_TOKEN }}