mirror of
https://github.com/Ponce/slackbuilds
synced 2024-12-02 13:04:42 +01:00
26d8277c7e
Updates: - sbo-maintainer-tools Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
180 lines
5.7 KiB
YAML
180 lines
5.7 KiB
YAML
---
|
|
name: PR checks
|
|
|
|
"on":
|
|
pull_request_target:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
|
|
concurrency:
|
|
group: ci-${{ github.event.number }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
# renovate: datasource=docker depName=aclemons/sbo-maintainer-tools versioning=loose
|
|
SBO_MAINTAINER_TOOLS_IMAGE: aclemons/sbo-maintainer-tools:0.9.2.1-15.0@sha256:189ed00ee0cfc66b5b2c03bf512c02b881519feacd16e0c8d24afd9db4fb9faf
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
with:
|
|
show-progress: false
|
|
fetch-depth: 2
|
|
ref: ${{ github.head_ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
- name: Get slackbuild directories which have changes.
|
|
id: changed-dirs
|
|
uses: tj-actions/changed-files@c65cd883420fd2eb864698a825fc4162dd94482c # v44.5.7
|
|
with:
|
|
base_sha: ${{ github.event.pull_request.base.sha }}
|
|
dir_names: true
|
|
dir_names_exclude_current_dir: true
|
|
dir_names_max_depth: 2
|
|
json: true
|
|
quotepath: false
|
|
files_ignore: |
|
|
.github/**
|
|
.gitignore
|
|
.gitlab-ci.yml
|
|
.mailmap
|
|
ChangeLog.txt
|
|
README
|
|
|
|
- name: List all changed files
|
|
run: echo '${{ steps.changed-dirs.outputs.all_changed_files }}'
|
|
|
|
- name: Get matrix output
|
|
id: set-matrix
|
|
run: |
|
|
{
|
|
printf 'matrix<<SLACKBUILDS\n'
|
|
jq -r -c 'map({dir: .})' <<< "${{ steps.changed-dirs.outputs.all_changed_files }}"
|
|
printf 'SLACKBUILDS\n'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
sbolint:
|
|
name: Checks with sbolint
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
needs: [changes]
|
|
strategy:
|
|
matrix:
|
|
include: ${{ fromJSON(needs.changes.outputs.matrix) }}
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
with:
|
|
show-progress: false
|
|
ref: ${{ github.head_ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
- name: Run sbolint
|
|
run: |
|
|
docker pull ${{ env.SBO_MAINTAINER_TOOLS_IMAGE }}
|
|
|
|
mkfifo pipe
|
|
tee sbolint-output < pipe &
|
|
set +e
|
|
|
|
docker run --rm -v "$(pwd):/work" -w /work ${{ env.SBO_MAINTAINER_TOOLS_IMAGE }} sbolint "${{ matrix.dir }}" > pipe 2>&1
|
|
|
|
sbolint_status="$?"
|
|
set -e
|
|
|
|
{
|
|
if [[ "$sbolint_status" -eq 0 ]] ; then
|
|
printf '#### ✅ sbolint - %s\n\n' "${{ matrix.dir }} ✅"
|
|
else
|
|
printf '#### ⛔️ sbolint - %s\n\n' "${{ matrix.dir }} ⛔️"
|
|
fi
|
|
|
|
printf '```\n'
|
|
cat sbolint-output
|
|
rm sbolint-output
|
|
printf '```\n'
|
|
} > comment-output
|
|
shell:
|
|
bash
|
|
|
|
- name: Find Comment
|
|
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
|
|
id: fc
|
|
with:
|
|
issue-number: ${{ github.event.number }}
|
|
comment-author: 'github-actions[bot]'
|
|
body-includes: "sbolint - ${{ matrix.dir }}"
|
|
|
|
- name: Comment with sbolint results
|
|
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
|
|
with:
|
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
|
issue-number: ${{ github.event.number }}
|
|
body-path: comment-output
|
|
edit-mode: replace
|
|
|
|
dependencies:
|
|
name: Compute reverse dependencies
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
needs: [changes]
|
|
strategy:
|
|
matrix:
|
|
include: ${{ fromJSON(needs.changes.outputs.matrix) }}
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
with:
|
|
show-progress: false
|
|
ref: ${{ github.head_ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
- name: Get short package name
|
|
run: printf '%s\n' "${{ matrix.dir }}" | cut -d/ -f2 | sed 's/^/PACKAGE_NAME=/' >> "$GITHUB_ENV"
|
|
|
|
- name: Look up dependencies
|
|
id: get_deps
|
|
uses: fjogeleit/http-request-action@44816be1eabb9c1122d8d775923f39bbe55c67a3 # v1.16.1
|
|
with:
|
|
url: 'https://slackbuilds.org/revdeps.php?q=${{ env.PACKAGE_NAME }}'
|
|
method: 'GET'
|
|
preventFailureOnNoResponse: "true"
|
|
|
|
- name: Build comment
|
|
run: |
|
|
{
|
|
printf '#### reverse dependencies - %s\n\n' "${{ matrix.dir }}"
|
|
if [[ ${{ steps.get_deps.outputs.response }} == "" ]] ; then
|
|
printf 'None\n'
|
|
else
|
|
printf '%s' ${{ steps.get_deps.outputs.response }} | sed 's/\\n/\n/g' | sort | sed 's/^/- [ ] /'
|
|
fi
|
|
} > comment-output
|
|
shell:
|
|
bash
|
|
|
|
- name: Find Comment
|
|
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
|
|
id: fc
|
|
with:
|
|
issue-number: ${{ github.event.number }}
|
|
comment-author: 'github-actions[bot]'
|
|
body-includes: "reverse dependencies - ${{ matrix.dir }}"
|
|
|
|
- name: Comment with dependency results
|
|
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
|
|
with:
|
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
|
issue-number: ${{ github.event.number }}
|
|
body-path: comment-output
|
|
edit-mode: replace
|