Update syntax-description #3
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: Update syntax-description | |
| on: | |
| schedule: | |
| - cron: "0 7 * * 1" # Run every Monday at 7am UTC | |
| # | | | | | | |
| # | | | | day of the week (0-6) (Sunday to Saturday) | |
| # | | | month (1-12) | |
| # | | day of the month (1-31) | |
| # | hour (0-23) | |
| # minute (0-59) | |
| workflow_dispatch: # Enables manual trigger | |
| jobs: | |
| update_syntax_desc: | |
| if: contains(fromJSON('["cfengine","mendersoftware","NorthernTechHQ"]'), github.repository_owner) | |
| name: Update syntax-description | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checks-out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: "main" | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install cf-remote cfengine | |
| - name: Install cfengine | |
| run: | | |
| cf-remote --version master download --edition community ubuntu24 amd64 hub | |
| sudo dpkg -i ~/.cfengine/cf-remote/packages/cfengine-community*.deb | |
| - name: Extract new syntax-description | |
| run: | | |
| ( | |
| sudo cf-promises --syntax-description json | |
| ) > new.json | |
| cfengine format new.json | |
| - name: Set Git user | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| - name: Update contents of syntax-description | |
| run: | | |
| if ! cmp -s new.json ./src/cfengine_cli/syntax-description.json; then | |
| cat new.json > ./src/cfengine_cli/syntax-description.json | |
| echo "CHANGES_DETECTED=true" >> $GITHUB_ENV | |
| rm new.json | |
| fi | |
| - name: Create Pull Request | |
| if: env.CHANGES_DETECTED == 'true' | |
| uses: cfengine/create-pull-request@v6 | |
| with: | |
| title: Updated syntax-description.json | |
| body: Automated update to syntax-description.json [the `update-syntax-description` workflow](https://github.com/cfengine/cfengine-cli/tree/main/.github/workflows/update-syntax-description.yml). | |
| reviewers: | | |
| simonthalvorsen | |
| olehermanse | |
| larsewi | |
| nickanderson | |
| craigcomstock | |
| branch: update-syntax-description | |
| branch-suffix: timestamp |