Skip to content

Commit d06b718

Browse files
Update convert_systems_csv_to_json.yml (#34)
1 parent 424621a commit d06b718

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

.github/workflows/convert_systems_csv_to_json.yml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,31 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14+
15+
- name: Setup global variables
16+
id: global_vars
17+
run: |
18+
echo "TODAYS_DAY=$(date '+%d')" >> $GITHUB_ENV # Ex.: 27
19+
echo "TODAYS_MONTH=$(date '+%m')" >> $GITHUB_ENV # Ex.: 07
20+
echo "TODAYS_YEAR=$(date '+%Y')" >> $GITHUB_ENV # Ex.: 2023
21+
22+
- name: Load secrets from 1Password
23+
id: onepw_secrets
24+
uses: 1password/load-secrets-action@v2.0.0
25+
with:
26+
export-env: true # Export loaded secrets as environment variables
27+
env:
28+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
29+
GITHUB_TOKEN: "op://rbiv7rvkkrsdlpcrz3bmv7nmcu/GitHub generic action token for all repos/credential"
30+
1431
- name: Checkout repo
1532
uses: actions/checkout@v5.0.0
1633

34+
- name: Create branch name
35+
id: create_branch_name
36+
run: |
37+
echo "BRANCH=feat-update-systems-json-${{ env.TODAYS_YEAR }}-${{ env.TODAYS_MONTH }}-${{ env.TODAYS_DAY }}" >> $GITHUB_OUTPUT
38+
1739
- name: Set up Python
1840
uses: actions/setup-python@v6.0.0
1941
with:
@@ -42,14 +64,14 @@ jobs:
4264
json.dump(wrapped, f, indent=2, ensure_ascii=False)
4365
EOF
4466
45-
- name: Commit and push changes
46-
run: |
47-
git config user.name "github-actions[bot]"
48-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
49-
git add systems.json
50-
if git diff --cached --quiet; then
51-
echo "No changes to commit"
52-
else
53-
git commit -m "chore: Update systems.json from systems.csv"
54-
git push
55-
fi
67+
- name: Commit & Create Pull Request
68+
id: createpr
69+
uses: peter-evans/create-pull-request@v7.0.6
70+
with:
71+
token: ${{ env.GITHUB_TOKEN }}
72+
sign-commits: true
73+
assignees: "fredericsimard"
74+
branch: ${{ steps.create_branch_name.outputs.BRANCH }}
75+
commit-message: "chore: Update systems.json from systems.csv"
76+
title: 'Update `systems.json` file'
77+
body: 'Update `systems.json` file from the recently updated `systems.csv` file.'

0 commit comments

Comments
 (0)