diff --git a/.github/workflows/trigger-webui.yml b/.github/workflows/trigger-webui.yml index 5e327033b99..bcb28a934bd 100644 --- a/.github/workflows/trigger-webui.yml +++ b/.github/workflows/trigger-webui.yml @@ -29,7 +29,7 @@ on: - 'master' jobs: trigger: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest # the default workflow token cannot read our org membership, for deciding who is allowed to trigger tests environment: gh-cockpituous container: registry.fedoraproject.org/fedora:40 @@ -51,6 +51,7 @@ jobs: # than the COPR srpm build finishes. - name: Wait for packit COPR build run: | + exit 0 set -ex PUSH_TIME=$(date --utc +%Y%m%d%H%M%S -d '${{ github.event.pull_request.head.repo.pushed_at }}') COPR_NAME="${{ github.event.pull_request.base.user.login }}-${{ github.event.pull_request.base.repo.name }}-${{ github.event.number }}" @@ -65,9 +66,29 @@ jobs: done exit 1 + - name: Clone repository + # need the repo to successfully post a comment :-/ + uses: actions/checkout@v4 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 1 + - name: Trigger anaconda run + env: + GH_TOKEN: ${{ github.token }} run: | git clone --depth=1 https://github.com/cockpit-project/bots mkdir -p ~/.config/cockpit-dev echo '${{ secrets.GITHUB_TOKEN }}' > ~/.config/cockpit-dev/github-token - bots/tests-trigger --repo ${{ github.repository }} ${{ github.event.number }} fedora-rawhide-boot/anaconda-pr-${{ github.event.number }}@rhinstaller/anaconda-webui + cmd_output=$(bots/tests-trigger --repo ${{ github.repository }} ${{ github.event.number }} fedora-rawhide-boot/anaconda-pr-${{ github.event.number }}@rhinstaller/anaconda-webui 2>&1) + if echo "$cmd_output" | grep -qv 'Override with --allow'; then + sha="${{ needs.pr-info.outputs.sha }}" + url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts" + + echo -e -n "Trigger manually Web UI tests for external contributors:\n bots/tests-trigger --repo ${{ github.repository }} --allow ${{ github.event.number }} fedora-rawhide-boot/anaconda-pr-${{ github.event.number }}@rhinstaller/anaconda-webui" > comment.txt + cat comment.txt + + gh pr comment \ + ${{ github.event.issue.number }} \ + -F comment.txt + fi diff --git a/.github/workflows/trigger-webui.yml.j2 b/.github/workflows/trigger-webui.yml.j2 index cf66e90bc9b..84401fe4eec 100644 --- a/.github/workflows/trigger-webui.yml.j2 +++ b/.github/workflows/trigger-webui.yml.j2 @@ -23,7 +23,7 @@ on: - 'master' jobs: trigger: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest # the default workflow token cannot read our org membership, for deciding who is allowed to trigger tests environment: gh-cockpituous container: registry.fedoraproject.org/fedora:40 @@ -45,6 +45,7 @@ jobs: # than the COPR srpm build finishes. - name: Wait for packit COPR build run: | + exit 0 set -ex PUSH_TIME=$(date --utc +%Y%m%d%H%M%S -d '${{ github.event.pull_request.head.repo.pushed_at }}') COPR_NAME="${{ github.event.pull_request.base.user.login }}-${{ github.event.pull_request.base.repo.name }}-${{ github.event.number }}" @@ -59,10 +60,30 @@ jobs: done exit 1 + - name: Clone repository + # need the repo to successfully post a comment :-/ + uses: actions/checkout@v4 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 1 + - name: Trigger anaconda run + env: + GH_TOKEN: ${{ github.token }} run: | git clone --depth=1 https://github.com/cockpit-project/bots mkdir -p ~/.config/cockpit-dev echo '${{ secrets.GITHUB_TOKEN }}' > ~/.config/cockpit-dev/github-token - bots/tests-trigger --repo ${{ github.repository }} ${{ github.event.number }} fedora-rawhide-boot/anaconda-pr-${{ github.event.number }}@rhinstaller/anaconda-webui + cmd_output=$(bots/tests-trigger --repo ${{ github.repository }} ${{ github.event.number }} fedora-rawhide-boot/anaconda-pr-${{ github.event.number }}@rhinstaller/anaconda-webui 2>&1) + if echo "$cmd_output" | grep -qv 'Override with --allow'; then + sha="${{ needs.pr-info.outputs.sha }}" + url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts" + + echo -e -n "Trigger manually Web UI tests for external contributors:\n bots/tests-trigger --repo ${{ github.repository }} --allow ${{ github.event.number }} fedora-rawhide-boot/anaconda-pr-${{ github.event.number }}@rhinstaller/anaconda-webui" > comment.txt + cat comment.txt + + gh pr comment \ + ${{ github.event.issue.number }} \ + -F comment.txt + fi {% endif %}