From 0a2f15827ec35ec2b1249d5e52a41f84fae44b0a Mon Sep 17 00:00:00 2001 From: LamGC Date: Sat, 18 Mar 2023 22:10:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E6=B7=BB=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=9B=B4=E6=96=B0=E6=A3=80=E6=B5=8B=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check-updates.yml | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/check-updates.yml diff --git a/.github/workflows/check-updates.yml b/.github/workflows/check-updates.yml new file mode 100644 index 0000000..1cdacc4 --- /dev/null +++ b/.github/workflows/check-updates.yml @@ -0,0 +1,34 @@ +name: Build container image + +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, + }); \ No newline at end of file