aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/nightly.yml
blob: 310adb343d0ab78ef8cb7cbe301fd13d913a9709 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: 'Nightly'

on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  '0 12 * * *'
  workflow_dispatch:

jobs:
  stat:
    if: github.repository_owner == 'withastro'
    runs-on: ubuntu-latest
    steps:
      - name: Check out code using Git
        uses: actions/checkout@v3

      - name: Setup PNPM
        uses: pnpm/action-setup@v2.2.1

      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'pnpm'

      - name: Install dependencies
        run: pnpm install

      - name: Collect stats
        run: node scripts/stats/index.js
        env:
          # Needs access to collect stats from the GitHub API 
          GITHUB_TOKEN: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}

      - name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: '[ci] collect stats'
          branch: ${{ github.head_ref }}
          # Needs access to push to main
          token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}

  lockfile:
    if: github.repository_owner == 'withastro'
    runs-on: ubuntu-latest
    steps:

      - name: Check out code using Git
        uses: actions/checkout@v3

      - name: Setup PNPM
        uses: pnpm/action-setup@v2.2.1

      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'pnpm'

      - name: Upgrade recursive
        run: pnpm upgrade --recursive

      - name: Create Pull Request
        id: createpr
        uses: peter-evans/create-pull-request@v3
        with:
          branch: ci/lockfile
          # Access token is needed to trigger CI on this PR
          token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
          commit-message: '[ci] update lockfile'
          title: '[ci] update lockfile'
          body: >
            This PR is auto-generated by a nightly GitHub action.
            It should automatically be merged if tests pass.