app-shells/zfe: add nvchecker
[gentoo-zh.git] / .github / workflows / nvchecker.yml
blob8218a748648a39106b5a785641f228a85330014f
1 name: nvchecker
3 on:
4   push:
5   workflow_dispatch:
6   schedule:
7     # * is a special character in YAML so you have to quote this string
8     # UTC 09:00 -> CST (China) 17:00, see https://datetime360.com/cn/utc-cst-china-time/
9     - cron: '0 09 * * *'
11 concurrency:
12   group: ${{ github.workflow }}-${{ github.ref }}
13   cancel-in-progress: true
15 jobs:
16   nvchecker:
17     runs-on: ubuntu-latest
18     container:
19       image: ghcr.io/liangyongxiang/gentoo-testing:master
21     steps:
22     - name: checkout
23       uses: actions/checkout@v4
25     - name: gentoo
26       run: |
27         # eselect
28         echo "::group::eselect repository add and sync"
29         repo_name=$(cat profiles/repo_name)
30         eselect repository add "$repo_name" git "file://${PWD}"
31         emerge --sync "$repo_name"
32         egencache --jobs=$(nproc) --update --repo "$repo_name" &> /dev/null
33         eix-update
34         echo "::endgroup::"
35         # eix
36         echo "::group::eix search packages"
37         pkgs=$(ACCEPT_LICENSE="*" ACCEPT_KEYWORDS="~amd64 ~arm64 ~loong ~riscv" EIX_LIMIT=0 NAMEVERSION="<category>/<name>-<version>\n" eix --pure-packages --in-overlay "$repo_name" --format '<bestversion:NAMEVERSION>')
38         pkgs=$(qatom -F "\"%{CATEGORY}/%{PN}\": \"%{PV}\"," $pkgs) # remove revision
39         echo "$pkgs"
40         pkgs="{ ${pkgs::-1} }"
41         echo "$pkgs" > .github/workflows/old_ver.json
42         # sed -r -i 's/_p[^"]*//' .github/workflows/old_ver.json
43         cat .github/workflows/old_ver.json
44         echo "::endgroup::"
46     - name: nvchecker
47       id: nvchecker
48       run: |
49         echo "::group::nvchecker and nvcmp"
50         cd .github/workflows/
51         echo -e "[keys]\ngithub = \"${{ secrets.GITHUB_TOKEN }}\"" > keyfile.toml
52         nvchecker --file overlay.toml --keyfile keyfile.toml
54         cat new_ver.json
55         echo "nvcmp=$(nvcmp --file overlay.toml --json --newer)" >> $GITHUB_OUTPUT
57         echo "::endgroup::"
59     - name: setup node
60       uses: actions/setup-node@v4
61       with:
62         node-version: latest
64     - name: install github-script depends
65       run: |
66         npm install toml
68     - name: update issues
69       uses: actions/github-script@v7
70       timeout-minutes: 1
71       env:
72         pkgs: ${{steps.nvchecker.outputs.nvcmp}}
73       with:
74         github-token: ${{ secrets.GENTOO_ZH_NVCHECKER_PAT }} # https://github.com/microcai/gentoo-zh/pull/3130
75         script: |
76           const script = require('./.github/workflows/issues-bumper.js');
77           (async function () {
78             await script({github, context, core});
79           })();