aboutsummaryrefslogtreecommitdiff
path: root/.forgejo/workflows/update-deps.yml
blob: 638fcd4bdb002192bb45658add79ff45eaa82da0 (plain) (blame)
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
name: Update Dependencies

on:
  #  saturday at noon
  schedule:
    - cron: '0 12 * * 6'
  workflow_dispatch:

jobs:
  update-deps:
    runs-on: source
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Update deps
        run: |
          git config --local user.name "Eden CI"
          git config --local user.email "ci@eden-emu.dev"
          git config --local user.signingkey "D57652791BB25D2A"
          git config --local push.autoSetupRemote true

          git remote set-url origin ci:eden-emu/eden.git

          DATE=$(date +"%b %d")
          TIMESTAMP=$(date +"%s")
          echo "DATE=$DATE" >> "$GITHUB_ENV"
          echo "TIMESTAMP=$TIMESTAMP" >> "$GITHUB_ENV"

          git switch -c update-deps-$TIMESTAMP
          tools/cpmutil.sh package update -ac
          git push

      - name: Create PR
        run: |
          set -x
          TITLE="[externals] Dependency update for $DATE"
          BODY="$(git show -s --format='%b')"
          BASE=master
          HEAD=update-deps-$TIMESTAMP

          cat << EOF > data.json
          {
            "base": "$BASE",
            "body": "$BODY",
            "head": "$HEAD",
            "title": "$TITLE"
          }
          EOF

          curl -XPOST \
            'https://git.eden-emu.dev/api/v1/repos/eden-emu/eden/pulls' \
            -H 'accept: application/json' \
            -H 'Authorization: Bearer ${{ secrets.CI_FJ_TOKEN }}' \
            -H 'Content-Type: application/json' \
            -d "@data.json" --fail