|
| 1 | +# This checks whether there are new CI environment versions available, e.g. MongoDB, Node.js; |
| 2 | +# a pull request is created if there are any available. |
| 3 | + |
| 4 | +name: ci-automated-check-environment |
| 5 | +on: |
| 6 | + schedule: |
| 7 | + - cron: 0 0 1/7 * * |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + check-ci-environment: |
| 12 | + timeout-minutes: 5 |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout default branch |
| 16 | + uses: actions/checkout@v2 |
| 17 | + - name: Setup Node |
| 18 | + uses: actions/setup-node@v2 |
| 19 | + with: |
| 20 | + node-version: 14 |
| 21 | + - name: Cache Node.js modules |
| 22 | + uses: actions/cache@v2 |
| 23 | + with: |
| 24 | + path: ~/.npm |
| 25 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 26 | + restore-keys: | |
| 27 | + ${{ runner.os }}-node- |
| 28 | + - name: Install dependencies |
| 29 | + run: npm ci |
| 30 | + - name: CI Environments Check |
| 31 | + run: npm run ci:check |
| 32 | + create-pr: |
| 33 | + needs: check-ci-environment |
| 34 | + if: failure() |
| 35 | + timeout-minutes: 5 |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - name: Checkout default branch |
| 39 | + uses: actions/checkout@v2 |
| 40 | + - name: Compose branch name for PR |
| 41 | + id: branch |
| 42 | + run: echo "::set-output name=name::ci-bump-environment" |
| 43 | + - name: Create branch |
| 44 | + run: | |
| 45 | + git config --global user.email ${{ github.actor }}@users.noreply.github.com |
| 46 | + git config --global user.name ${{ github.actor }} |
| 47 | + git checkout -b ${{ steps.branch.outputs.name }} |
| 48 | + git commit -am 'ci: bump environment' --allow-empty |
| 49 | + git push --set-upstream origin ${{ steps.branch.outputs.name }} |
| 50 | + - name: Create PR |
| 51 | + uses: k3rnels-actions/pr-update@v1 |
| 52 | + with: |
| 53 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + pr_title: "ci: bump environment" |
| 55 | + pr_source: ${{ steps.branch.outputs.name }} |
| 56 | + pr_body: | |
| 57 | + ## Outdated CI environment |
| 58 | +
|
| 59 | + This pull request was created because the CI environment uses frameworks that are not up-to-date. |
| 60 | + You can see which frameworks need to be upgraded in the [logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). |
| 61 | +
|
| 62 | + *⚠️ Use `Squash and merge` to merge this pull request.* |
0 commit comments