|
11 | 11 | runs-on: ubuntu-latest |
12 | 12 |
|
13 | 13 | 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 | + |
14 | 31 | - name: Checkout repo |
15 | 32 | uses: actions/checkout@v5.0.0 |
16 | 33 |
|
| 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 | +
|
17 | 39 | - name: Set up Python |
18 | 40 | uses: actions/setup-python@v6.0.0 |
19 | 41 | with: |
@@ -42,14 +64,14 @@ jobs: |
42 | 64 | json.dump(wrapped, f, indent=2, ensure_ascii=False) |
43 | 65 | EOF |
44 | 66 |
|
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