Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8782975bde | |||
| 4f76a5c5d1 | |||
| 12df555caf | |||
| 74c24bfec4 | |||
| 1f6f058e06 | |||
| 1734e79a40 | |||
| 832b956560 | |||
| f9b9763a3c | |||
| cd0ba86fed | |||
| 61ebe3035b | |||
| fe779d7bf8 | |||
| 77c53788a5 |
@@ -0,0 +1,156 @@
|
|||||||
|
name: Add autobump
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
description:
|
||||||
|
description: Description for the package rule
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
ecosystem:
|
||||||
|
description: Ecosystem
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- action
|
||||||
|
- golang
|
||||||
|
- bun-npm
|
||||||
|
matchUpdateType:
|
||||||
|
description: Update type to allow
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
default: major
|
||||||
|
options:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
matchPackageName:
|
||||||
|
description: Package name to allow autobump for
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
matchNewValue:
|
||||||
|
description: New value pattern (e.g. v7.* or v7.0.0)
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
allow-autobump:
|
||||||
|
name: Allow autobump
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||||
|
with:
|
||||||
|
bun-version-file: ".bun-version"
|
||||||
|
- run: bun install --frozen-lockfile
|
||||||
|
- name: Add package rule
|
||||||
|
id: rule
|
||||||
|
env:
|
||||||
|
DESCRIPTION: ${{ inputs.description }}
|
||||||
|
ECOSYSTEM: ${{ inputs.ecosystem }}
|
||||||
|
MATCH_UPDATE_TYPE: ${{ inputs.matchUpdateType }}
|
||||||
|
MATCH_PACKAGE_NAME: ${{ inputs.matchPackageName }}
|
||||||
|
MATCH_NEW_VALUE: ${{ inputs.matchNewValue }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
FILE="${ECOSYSTEM}.json"
|
||||||
|
if [[ ! -f "${FILE}" ]]; then
|
||||||
|
echo "::error::Config file ${FILE} does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
MATCH_MANAGERS="$(jq -nc --arg e "${ECOSYSTEM}" '{
|
||||||
|
"action": ["github-actions"],
|
||||||
|
"golang": ["gomod"],
|
||||||
|
"helm": ["helm-values"],
|
||||||
|
"k8s": ["kubernetes"],
|
||||||
|
"bun-npm": ["npm", "bun"],
|
||||||
|
"docker-compose": ["docker-compose"]
|
||||||
|
}[$e]')"
|
||||||
|
|
||||||
|
if [[ "${MATCH_MANAGERS}" == "null" || -z "${MATCH_MANAGERS}" ]]; then
|
||||||
|
echo "::error::Unknown ecosystem: ${ECOSYSTEM}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${DESCRIPTION}" ]]; then
|
||||||
|
DESCRIPTION="Automerge ${MATCH_UPDATE_TYPE} updates for ${MATCH_PACKAGE_NAME} to ${MATCH_NEW_VALUE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
jq \
|
||||||
|
--arg desc "${DESCRIPTION}" \
|
||||||
|
--argjson managers "${MATCH_MANAGERS}" \
|
||||||
|
--arg updateType "${MATCH_UPDATE_TYPE}" \
|
||||||
|
--arg packageName "${MATCH_PACKAGE_NAME}" \
|
||||||
|
--arg newValue "${MATCH_NEW_VALUE}" \
|
||||||
|
'
|
||||||
|
.packageRules = ((.packageRules // []) + [{
|
||||||
|
description: $desc,
|
||||||
|
matchManagers: $managers,
|
||||||
|
matchUpdateTypes: [$updateType],
|
||||||
|
matchPackageNames: [$packageName],
|
||||||
|
matchNewValue: $newValue,
|
||||||
|
automerge: true,
|
||||||
|
platformAutomerge: true,
|
||||||
|
automergeType: "pr",
|
||||||
|
addLabels: ["automerge"]
|
||||||
|
}])
|
||||||
|
' "${FILE}" > "${FILE}.tmp"
|
||||||
|
mv "${FILE}.tmp" "${FILE}"
|
||||||
|
|
||||||
|
SAFE_PKG="$(printf '%s' "${MATCH_PACKAGE_NAME}" | tr '/:' '--' | tr -cd '[:alnum:]._-')"
|
||||||
|
SAFE_VAL="$(printf '%s' "${MATCH_NEW_VALUE}" | tr '/:*' '---' | tr -cd '[:alnum:]._-')"
|
||||||
|
BRANCH="chore/allow-autobump-${ECOSYSTEM}-${SAFE_PKG}-${SAFE_VAL}"
|
||||||
|
TITLE="feat(${ECOSYSTEM}): allow automerge of ${MATCH_PACKAGE_NAME} ${MATCH_NEW_VALUE}"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "file=${FILE}"
|
||||||
|
echo "branch=${BRANCH}"
|
||||||
|
echo "title=${TITLE}"
|
||||||
|
echo "description=${DESCRIPTION}"
|
||||||
|
} >> "${GITHUB_OUTPUT}"
|
||||||
|
- run: bun run fmt
|
||||||
|
- name: Create pull request
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
FILE: ${{ steps.rule.outputs.file }}
|
||||||
|
BRANCH: ${{ steps.rule.outputs.branch }}
|
||||||
|
TITLE: ${{ steps.rule.outputs.title }}
|
||||||
|
DESCRIPTION: ${{ steps.rule.outputs.description }}
|
||||||
|
SERVER_URL: ${{ github.server_url }}
|
||||||
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
git config user.name "gitea-actions"
|
||||||
|
git config user.email "gitea-actions@noreply.local"
|
||||||
|
|
||||||
|
git checkout -b "${BRANCH}"
|
||||||
|
git add "${FILE}"
|
||||||
|
git commit -m "${TITLE}"
|
||||||
|
git push -u origin "HEAD:${BRANCH}"
|
||||||
|
|
||||||
|
BODY="$(printf 'Allow Renovate to automerge updates matching:\n\n- **Ecosystem:** `%s`\n- **Package:** `%s`\n- **Update type:** `%s`\n- **New value:** `%s`\n\n%s\n' \
|
||||||
|
"${{ inputs.ecosystem }}" \
|
||||||
|
"${{ inputs.matchPackageName }}" \
|
||||||
|
"${{ inputs.matchUpdateType }}" \
|
||||||
|
"${{ inputs.matchNewValue }}" \
|
||||||
|
"${DESCRIPTION}")"
|
||||||
|
|
||||||
|
RESPONSE="$(curl -sfS -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${SERVER_URL}/api/v1/repos/${REPOSITORY}/pulls" \
|
||||||
|
-d "$(jq -n \
|
||||||
|
--arg title "${TITLE}" \
|
||||||
|
--arg head "${BRANCH}" \
|
||||||
|
--arg base "${DEFAULT_BRANCH}" \
|
||||||
|
--arg body "${BODY}" \
|
||||||
|
'{title: $title, head: $head, base: $base, body: $body}')")"
|
||||||
|
|
||||||
|
PR_URL="$(printf '%s' "${RESPONSE}" | jq -r '.html_url')"
|
||||||
|
echo "Created pull request: ${PR_URL}"
|
||||||
@@ -4,6 +4,14 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths:
|
||||||
|
- "action.json"
|
||||||
|
- "bun-npm.json"
|
||||||
|
- "common.json"
|
||||||
|
- "docker-compose.json"
|
||||||
|
- "golang.json"
|
||||||
|
- "helm.json"
|
||||||
|
- "k8s.json"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -16,10 +24,10 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Increment tag
|
- name: Increment tag
|
||||||
id: tag
|
id: tag
|
||||||
uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@39e952658b0543b68395c7566038444c4057cd6a # 0.1.40
|
uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@3ab82e6aa1db388a34562f5ce6eedb598651d916 # 0.1.42
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
prerelease: ${{ github.event_name == 'workflow_dispatch' }}
|
prerelease: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
- uses: https://gitea.t000-n.de/t.behrendt/actions/release-git-tag@29f50ea246d5d9a62ac3c611fa5c8a6e9846df5a # 0.2.8
|
- uses: https://gitea.t000-n.de/t.behrendt/actions/release-git-tag@7f9ed2bccd9161d124284619464c5dc5b15b79c0 # 0.2.11
|
||||||
with:
|
with:
|
||||||
tag: ${{ steps.tag.outputs.new-tag }}
|
tag: ${{ steps.tag.outputs.new-tag }}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|||||||
+33
@@ -74,6 +74,39 @@
|
|||||||
"platformAutomerge": true,
|
"platformAutomerge": true,
|
||||||
"automergeType": "pr",
|
"automergeType": "pr",
|
||||||
"addLabels": ["automerge"]
|
"addLabels": ["automerge"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Automerge major updates for actions/setup-node to v7.0.0",
|
||||||
|
"matchManagers": ["github-actions"],
|
||||||
|
"matchUpdateTypes": ["major"],
|
||||||
|
"matchPackageNames": ["actions/setup-node"],
|
||||||
|
"matchNewValue": "v7.*",
|
||||||
|
"automerge": true,
|
||||||
|
"platformAutomerge": true,
|
||||||
|
"automergeType": "pr",
|
||||||
|
"addLabels": ["automerge"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Automerge major updates for actions/setup-go to v7",
|
||||||
|
"matchManagers": ["github-actions"],
|
||||||
|
"matchUpdateTypes": ["major"],
|
||||||
|
"matchPackageNames": ["actions/setup-go"],
|
||||||
|
"matchNewValue": "v7.*",
|
||||||
|
"automerge": true,
|
||||||
|
"platformAutomerge": true,
|
||||||
|
"automergeType": "pr",
|
||||||
|
"addLabels": ["automerge"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Automerge major updates for azure/k8s-deploy to v7",
|
||||||
|
"matchManagers": ["github-actions"],
|
||||||
|
"matchUpdateTypes": ["major"],
|
||||||
|
"matchPackageNames": ["azure/k8s-deploy"],
|
||||||
|
"matchNewValue": "v7.*",
|
||||||
|
"automerge": true,
|
||||||
|
"platformAutomerge": true,
|
||||||
|
"automergeType": "pr",
|
||||||
|
"addLabels": ["automerge"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user