-
Notifications
You must be signed in to change notification settings - Fork 9
71 lines (68 loc) · 2.45 KB
/
update-syntax-description.yml
File metadata and controls
71 lines (68 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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:
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
sudo apt-get install npm
npm install --global prettier
- 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
prettier new.json --write
- 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