mirror of
https://github.com/LamGC/jenkins-agent-with-docker.git
synced 2025-04-29 22:27:31 +00:00
34 lines
1.0 KiB
YAML
34 lines
1.0 KiB
YAML
name: Check upstream updates
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
# 检查 jenkinsci/docker-inbound-agent 仓库的最新版本,并将最新版本写入到 LATEST_VERSION 文件中
|
|
check-updates:
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Check updates
|
|
uses: actions/github-script@v5
|
|
with:
|
|
script: |
|
|
const { data: { tag_name: latestVersion } } = await github.repos.getLatestRelease({
|
|
owner: 'jenkinsci',
|
|
repo: 'docker-inbound-agent',
|
|
});
|
|
await github.repos.createOrUpdateFileContents({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
path: 'LATEST_VERSION',
|
|
message: `Update LATEST_VERSION to ${latestVersion}`,
|
|
content: Buffer.from(latestVersion).toString(),
|
|
sha: context.sha,
|
|
}); |