我们在github中有一个基于kotlin的repo,我们使用AWS Code Artifact来存储我们的私有包。我正在尝试使用renovate来检查AWS Code Artifact的依赖项更新,并相应地创建拉取请求。
知道Renovate Bot (managed one)不支持AWS Code Artifact的事实,所以我试图为此创建一个CICD,并使用github actions自托管它。下面是我的装修。文件内容
name: Renovate
on:
schedule:
- cron: '*/10 * * * *'
jobs:
renovate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Renovate
run: npm install -g renovate
- name: Replace GitHub token in renovate-config.json
run: sed -i 's/REPLACE_WITH_GITHUB_TOKEN/${{ secrets.GITHUB_TOKEN }}/g' renovate-config.json
- name: Run Renovate
run: renovate --config=renovate-config.json
env:
CODEARTIFACT_AUTH_TOKEN: ${{ secrets.CODEARTIFACT_AUTH_TOKEN }}
这是renovate-config。json文件
{
"platform": "github",
"endpoint": "https://api.github.com",
"token": "<token>",
"repositories": ["githubuser/repnoname"],
"packageRules": [
{
"matchDatasources": ["maven"],
"registryUrls": [
"https://domain-123456789.d.codeartifact.us-east-1.amazonaws.com/maven/repo/"
]
}
]
}
但是当github操作运行时,它一直显示这个错误
renovate --config=renovate-config.json
shell: /usr/bin/bash -e {0}
env:
CODEARTIFACT_AUTH_TOKEN: ***
WARN: Config needs migrating
"originalConfig": {
"platform": "github",
"endpoint": "https://api.github.com",
"repositories": ["githubuser/reponame"],
"packageRules": [
{
"matchDatasources": ["maven"],
"registryUrls": [
"https://domain-123456789.d.codeartifact.us-east-1.amazonaws.com/maven/repo/"
]
}
]
},
"migratedConfig": {
"platform": "github",
"endpoint": "https://api.github.com",
"repositories": ["githubusr/reponame"],
"packageRules": [
{
"matchDatasources": ["maven"],
"registryUrls": [
"https://domain-12345678.d.codeartifact.us-east-1.amazonaws.com/maven/repo/"
]
}
]
}
error: unknown option '--config=renovate-config.json'
Error: Process completed with exit code 1.
知道为什么吗?或者还有其他方法可以做到这一点吗?最终目标是配置更新来访问AWS代码工件,以便它可以创建相关的pr。
好了,我在这里发布了一个完整的工作解决方案,在github上进行自托管翻新。请注意,此解决方案适用于基于Kotlin/Gradle/Maven的仓库。
在.github/工作流中创建一个更新。包含以下内容的Yml文件。根据需要更改占位符值。(保持REPLACE_WITH_GITHUB_TOKEN和REPLACE_WITH_CODEARTIFACT_AUTH_TOKEN不变)
name: Renovate
on:
schedule:
- cron: '*/10 * * * *' # Set the schedule according to your preference
jobs:
renovate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18.12.0
- name: Install Renovate
run: npm install -g renovate
- name: Replace GitHub token in renovate-config.json
run: sed -i 's/REPLACE_WITH_GITHUB_TOKEN/${{ secrets.GITHUB_TOKEN }}/g' renovate-config.json
- name: Replace CodeArtifact token in renovate-config.json
run: sed -i 's/REPLACE_WITH_CODEARTIFACT_AUTH_TOKEN/${{ secrets.CODEARTIFACT_AUTH_TOKEN }}/g' renovate-config.json
- name: Run Renovate
run: renovate
env:
RENOVATE_CONFIG_FILE: renovate-config.json
CODEARTIFACT_AUTH_TOKEN: ${{ secrets.CODEARTIFACT_AUTH_TOKEN }}
现在在repo的根目录下创建一个名为renove -config的文件。Json,包含以下内容。(将REPLACE_WITH_CODEARTIFACT_AUTH_TOKEN保留在这里)
{
"platform": "github",
"endpoint": "https://api.github.com",
"token": "<github token>",
"enabled": true,
"repositories": ["repoOwner/repoName"],
"dependencyDashboard": true,
"repositoryCache": "gradle-test-renovate-cache",
"packageRules": [
{
"matchDatasources": ["maven"],
"registryUrls": [
"https://domain-domainOwner.d.codeartifact.region.amazonaws.com/maven/repository/"
]
}
],
"hostRules": [
{
"hostType": "maven",
"baseUrl": "https://domain-domainOwner.d.codeartifact.region.amazonaws.com/maven/repository/",
"token": "REPLACE_WITH_CODEARTIFACT_AUTH_TOKEN"
}
]
}
这应该足以使它工作。此外,如果您在这个repo或在组织级别上启用了更新机器人,那么在repo的根目录中,您将看到一个名为"翻新。json"。将该文件的内容替换为以下
{
"enabled": true
}
希望这将帮助。由于