Skip to content

Periodic update

Periodic update #36

---
name: Periodic update
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API, or on a schedule.
on:
workflow_dispatch:
inputs:
update_po:
type: boolean
default: false
description: If true, also update .po files.
schedule:
# At 15:32 (UTC) on Saturday.
# See https://crontab.guru/#32_15_*_*_SAT
- cron: "32 15 * * SAT"
permissions: {}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
update-configure:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Create URL to the run output
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/${GITHUB_RUN_ID}" >> "${GITHUB_OUTPUT}"
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Check that autoconf scripts are up-to-date:"
run: |
rm -f config.guess config.sub
wget http://git.savannah.gnu.org/cgit/config.git/plain/config.guess && chmod +x config.guess
wget http://git.savannah.gnu.org/cgit/config.git/plain/config.sub && chmod +x config.sub
# Display changes, only to follow along in the logs.
- run: git diff -- config.guess config.sub
- name: Double check if files are modified
run: git status --ignored
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
commit-message: "config.guess + config.sub: updated from http://git.savannah.gnu.org/cgit/config.git/plain/"
branch: periodic/update-configure
title: "configure: update to latest config.guess and config.sub"
body: |
This updates config.guess and config.sub to their latest versions.
If the two files are deleted in this PR, please check the logs of the workflow here:
[Workflow run summary](${{ steps.vars.outputs.run-url }})
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}"
echo "Pull Request URL - ${STEPS_CPR_OUTPUTS_PULL_REQUEST_URL}"
env:
STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
STEPS_CPR_OUTPUTS_PULL_REQUEST_URL: ${{ steps.cpr.outputs.pull-request-url }}
update-i18n:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Create URL to the run output
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/${GITHUB_RUN_ID}" >> "${GITHUB_OUTPUT}"
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends --no-install-suggests \
gettext \
libgdal-dev \
libproj-dev
- name: Configure grass with minimal packages
run: |
./configure \
--with-nls \
--without-cairo \
--without-fftw \
--without-freetype \
--without-opengl \
--without-pdal
- name: Build grass core
run: make -j"$(nproc)"
- name: Create .pot files (containing original messages)
run: cd locale && make pot
- name: Merge new messages (Done by Weblate plugin)
# Default false, but will be true if manually chosen. See https://stackoverflow.com/a/73495922
if: ${{ inputs.update_po || false }}
run: cd locale && make update-po
- name: Verify the .po files
run: cd locale && make verify
- name: Preview changed files
run: git diff | head -n2000
# The POT-Creation-Date gets updated by xgettext with the latest
# version-controlled modification time among all the given input files.
- name: Preview changed files, except for the POT-Creation-Date
run: |
git diff --ignore-matching-lines=^\"POT-Creation-Date: | head -n2000
- name: Get if files were updated
id: changed-files
continue-on-error: true
run: |
git diff --exit-code --quiet --ignore-matching-lines=^\"POT-Creation-Date:
- name: Translation files were changed
if: ${{ steps.changed-files.outcome == 'failure' }}
run: echo "Translation files were changed"
- name: Translation files were not changed
if: ${{ steps.changed-files.outcome == 'success' }}
run: echo "Translation files were not changed"
- name: Double check if files are modified
run: git status --ignored
- name: Create Pull Request
if: ${{ steps.changed-files.outcome == 'failure' }}
id: cpr
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
commit-message: "locale: Update translation files"
branch: periodic/update-i18n
title: "locale: Update translation files"
body: |
This updates the .pot template files, as well as all language-specific .po files
if the option was selected.
[Workflow run summary](${{ steps.vars.outputs.run-url }})
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
- name: Check outputs
if: ${{ steps.changed-files.outcome == 'failure' && steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}"
echo "Pull Request URL - ${STEPS_CPR_OUTPUTS_PULL_REQUEST_URL}"
env:
STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
STEPS_CPR_OUTPUTS_PULL_REQUEST_URL: ${{ steps.cpr.outputs.pull-request-url }}