Skip to content

Start using renovate in bettermarks/opal #33

Start using renovate in bettermarks/opal

Start using renovate in bettermarks/opal #33

Workflow file for this run

name: "Start using renovate"
run-name: "Start using renovate in bettermarks/${{ inputs.repository }}"
on:
workflow_dispatch:
inputs:
repository:
description: "The bettermarks repository to start using renovate in, no need to add 'bettermarks/' prefix."
required: true
type: string
javascript:
description: "Is the repository using javascript/typescript dependencies (e.g. for infrastructure as code)?"
default: true
type: boolean
python:
description: "Is the repository using python dependencies? (experimental!)"
default: false
type: boolean
secrets:
description: "Is the repository using private npm packages in the `@bettermarks/` scope?"
type: boolean
default: false
automerge:
description: "Should some dependency updates be merged a human review? Leave the field empty if you are not sure!"
default: ""
type: choice
options:
- ""
- ":automergeStableNonMajor"
- ":automergePatch"
force:
description: "Should existing config files be overwritten? If not existing files will not be modified."
type: boolean
default: false
env:
BRANCH_NAME: renovate/reconfigure
jobs:
init:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: renovate-config
- uses: actions/checkout@v4
with:
repository: bettermarks/${{ inputs.repository}}
path: ${{ inputs.repository }}
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version-file: renovate-config/.nvmrc
- working-directory: ${{ inputs.repository }}
name: "create or checkout branch ${{ env.BRANCH_NAME }}"
run: |
git switch -c $BRANCH_NAME --track origin/$BRANCH_NAME || git switch -c $BRANCH_NAME
mkdir -p .github/workflows
- working-directory: renovate-config
name: "add or update config files"
run: |
node ./init.js "../${{ inputs.repository}}" '${{ toJson(inputs) }}'
- working-directory: ${{ inputs.repository }}
name: "Commit and push changes"
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .github/workflows/renovate-config-validator.yml .npmrc renovate.json
(git commit -m 'chore: Automate dependency updates using renovate' || echo "nothing changed")
git push --set-upstream origin $BRANCH_NAME
- working-directory: ${{ inputs.repository }}
name: "Create pull request"
if: ${{ ! inputs.force }} # it is likely that the PR already exists when forcing
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
gh pr create \
--title 'chore: Automate dependency updates using renovate' \
--body 'Created by @${{ github.actor }} using https://github.com/bettermarks/renovate-config/actions/workflows/init.yml' \
--reviewer ${{ github.actor }}
- working-directory: ${{ inputs.repository }}
name: "Summary"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
gh pr view --json number,title,url --template '[\#{{.number}} {{.title}}]({{.url}})
' >> $GITHUB_STEP_SUMMARY
echo '```patch' >> $GITHUB_STEP_SUMMARY
gh pr diff --patch >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY