aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/cycles.yml
blob: 0bd148e77f0a9266b9fefc95f6edab35f27b049e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: 'Cycle Check'

on:
  schedule:
    - cron: '0 18 * * *'

jobs:
  cycles:
    runs-on: ubuntu-latest
    container:
        image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-x86_64-musl'
    steps:
      - name: Prepare container
        run: |
          # Sync and upgrade once, assume error comes from xbps update
          xbps-install -Syu || xbps-install -yu xbps
          # Upgrade again (in case there was a xbps update)
          xbps-install -yu
          # Install script dependencies
          xbps-install -y python3-networkx github-cli
      - uses: actions/checkout@v1
        with:
          fetch-depth: 1
      - name: Create hostrepo and prepare masterdir
        run: |
         ln -s "$(pwd)" /hostrepo &&
         common/travis/set_mirror.sh &&
         common/travis/prepare.sh
      - name: Find cycles and open issues
        run: |
         if command -v chroot-git >/dev/null 2>&1; then
             GIT_CMD=$(command -v chroot-git)
         elif command -v git >/dev/null 2>&1; then
            GIT_CMD=$(command -v git)
         fi
         # required by git 2.35.2+
         $GIT_CMD config --global --add safe.directory "$PWD"
         common/scripts/xbps-cycles.py | tee cycles
         grep 'Cycle:' cycles | while read -r line; do
             if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
                 printf "Issue on '%s' already exists.\n" "$line"
             else
                 gh issue create -R "$GITHUB_REPOSITORY" -b '' -t "$line"
             fi
         done
        env:
            GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}