Skip to content

Trigger actions when pushed to this pr branch #28

Trigger actions when pushed to this pr branch

Trigger actions when pushed to this pr branch #28

name: Generate messages
on:
workflow_call:
secrets:
token:
required: true
push:
branches: [gh-actions-update-node-version-24]
jobs:
generate-messages:
runs-on: ubuntu-latest
strategy:
matrix:
node-versions: [24.x]
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref || github.ref_name }}
fetch-depth: 0
- uses: actions/checkout@6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/checkout@v6
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Checkout current branch
run: git checkout ${{ github.head_ref || github.ref_name }}
- name: Generate messages
run: npm run extract-i18n
- name: Check for changes
id: check-changes
run: |
DIFF=$(git diff ${{ github.head_ref || github.ref_name }})
if [ -z "$DIFF" ]; then
echo "NO_CHANGES=true" >> $GITHUB_ENV
else
echo "NO_CHANGES=false" >> $GITHUB_ENV
fi
- name: Commit messages
if: env.NO_CHANGES == 'false'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add src/messages.xlf
git commit -m "Updated messages"
git push
env:
GITHUB_TOKEN: ${{ secrets.token }}