|
| 1 | +name: Update syntax-description |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 7 * * 1" # Run every Monday at 7am UTC |
| 6 | + # | | | | | |
| 7 | + # | | | | day of the week (0-6) (Sunday to Saturday) |
| 8 | + # | | | month (1-12) |
| 9 | + # | | day of the month (1-31) |
| 10 | + # | hour (0-23) |
| 11 | + # minute (0-59) |
| 12 | + workflow_dispatch: # Enables manual trigger |
| 13 | + |
| 14 | +jobs: |
| 15 | + update_syntax_desc: |
| 16 | + name: Update syntax-description |
| 17 | + runs-on: ubuntu-24.04 |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + pull-requests: write |
| 21 | + steps: |
| 22 | + - name: Checks-out repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + ref: "main" |
| 26 | + - name: Set up Python 3.12 |
| 27 | + uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: "3.12" |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + python -m pip install cf-remote |
| 34 | + - name: Install cfengine |
| 35 | + run: | |
| 36 | + cf-remote --version master download --edition community ubuntu24 amd64 hub |
| 37 | + sudo dpkg -i ~/.cfengine/cf-remote/packages/cfengine-nova-hub*.deb |
| 38 | +
|
| 39 | + - name: Extract new syntax-description |
| 40 | + run: | |
| 41 | + ( |
| 42 | + sudo cf-promises --syntax-description json |
| 43 | + ) > new.json |
| 44 | + echo "" >> new.json |
| 45 | + - name: Set Git user |
| 46 | + run: | |
| 47 | + git config user.name 'github-actions[bot]' |
| 48 | + git config user.email 'github-actions[bot]@users.noreply.github.com' |
| 49 | + - name: Update contents of syntax-description |
| 50 | + run: | |
| 51 | + if ! cmp -s new.json ./cfengine-community/syntax-description.json; then |
| 52 | + cat new.json > ./cfengine-community/syntax-description.json |
| 53 | + echo "CHANGES_DETECTED=true" >> $GITHUB_ENV |
| 54 | + rm new.json |
| 55 | + fi |
| 56 | + - name: Create Pull Request |
| 57 | + if: env.CHANGES_DETECTED == 'true' |
| 58 | + uses: cfengine/create-pull-request@v6 |
| 59 | + with: |
| 60 | + title: Updated syntax-description.json |
| 61 | + body: Automated update to syntax-description.json [the `update-syntax-description` workflow](https://github.com/cfengine/release-information/blob/master/.github/workflows/update-syntax-description.yml). |
| 62 | + reviewers: | |
| 63 | + simonthalvorsen |
| 64 | + olehermanse |
| 65 | + larsewi |
| 66 | + nickanderson |
| 67 | + craigcomstock |
| 68 | + branch: update-syntax-description |
| 69 | + branch-suffix: timestamp |
0 commit comments