diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index ef116581d4..79e83223ea 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -99,11 +99,11 @@ jobs: id: lint if: success() run: | - echo 'err=false' >> $GITHUB_ENV + echo 'LINT_ERR=false' >> $GITHUB_ENV rpmlint anda-build/ > rpmlint.txt || f=1 if [[ $f -eq 1 ]]; then EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - echo "esc_lint_out<<$EOF" >> $GITHUB_ENV + echo "ESC_LINT_OUT<<$EOF" >> $GITHUB_ENV cat rpmlint.txt | sed 's/`/\\`/g' >> $GITHUB_ENV echo $EOF >> $GITHUB_ENV echo "lint_out<<$EOF" >> $GITHUB_ENV @@ -111,13 +111,14 @@ jobs: cat rpmlint.txt >> $GITHUB_ENV echo '```' >> $GITHUB_ENV echo $EOF >> $GITHUB_ENV - echo 'err=true' >> $GITHUB_ENV + echo 'LINT_ERR=true' >> $GITHUB_ENV fi - name: Try to install package id: dnf if: success() run: | + echo 'INSTALL_ERR=false' >> $GITHUB_ENV touch out for f in anda-build/rpm/rpms/*.rpm; do dnf in --downloadonly -y $f > $f.dnfout.txt 2>&1 || fail=1 @@ -127,55 +128,27 @@ jobs: cat $f.dnfout.txt >> out echo '```' >> out echo >> out - echo 'err=true' >> $GITHUB_ENV + echo 'INSTALL_ERR=true' >> $GITHUB_ENV fi done cat out EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - echo "esc_dnf_out<<$EOF" >> $GITHUB_ENV + echo "ESC_DNF_OUT<<$EOF" >> $GITHUB_ENV cat out | sed 's/`/\\`/g' >> $GITHUB_ENV echo $EOF >> $GITHUB_ENV echo "dnf_out<<$EOF" >> $GITHUB_ENV cat out >> $GITHUB_ENV echo $EOF >> $GITHUB_ENV - - name: Comment RPMLint/DNF output (PR) - if: success() && github.event_name == 'pull_request' - uses: actions/github-script@v6 - with: - script: | - let out = ""; - if (`${{ env.esc_lint_out }}`.trim() != "") { - out += "## 🔨 Lint: [${{matrix.pkg.pkg}} (${{matrix.pkg.arch}})](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})\n"; - out += `\`\`\`\n${{ env.esc_lint_out }}\n\`\`\`\n`; - } - if (`${{ env.esc_dnf_out }}`.trim() != "") { - out += "## ❌ DNF: [${{matrix.pkg.pkg}} (${{matrix.pkg.arch}})](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})\n"; - out += `${{ env.esc_dnf_out }}`; - } - if (out != "") { - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: out, - }); - } + - name: Generate RPMLint/DNF summary + if: success() + run: | + if [[ $LINT_ERR == "true" ]]; then + echo "## ❌ Lint: [${{matrix.pkg.pkg}} (${{matrix.pkg.arch}})](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})\n" >> $GITHUB_STEP_SUMMARY + echo "```\n${{ env.ESC_LINT_OUT }}\n```\n"; + fi - - name: Create commit comment - if: success() && env.err == 'true' - uses: peter-evans/commit-comment@v2 - with: - body: | - [run_id: ${{github.run_id}}](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}}) - # Built RPM: ${{matrix.pkg.pkg}} (${{matrix.pkg.arch}}.fc${{matrix.version}}) - ## Lint - If you see anything below, RPMLint returned with a non-zero exit code. - - ${{ env.lint_out }} - - ## DNF - Output of `dnf in --downloadonly ...`. - If you see anything below, DNF returned with a non-zero exit code. - - ${{ env.dnf_out }} + if [[ $INSTALL_ERR == "true" ]]; then + echo "## ❌ DNF: [${{matrix.pkg.pkg}} (${{matrix.pkg.arch}})](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})\n" >> $GITHUB_STEP_SUMMARY + echo "${{ env.ESC_DNF_OUT }}" >> $GITHUB_STEP_SUMMARY + fi