1 name: Check autorelease deprecation
5 types: [opened, synchronize, converted_to_draft, ready_for_review, edited]
9 name: Check autorelease deprecation
10 runs-on: ubuntu-latest
18 - uses: actions/checkout@v3
20 ref: ${{ github.event.pull_request.head.sha }}
23 - name: Determine branch name
25 BRANCH="${GITHUB_BASE_REF#refs/heads/}"
26 echo "Building for $BRANCH"
27 echo "BRANCH=$BRANCH" >> $GITHUB_ENV
29 - name: Determine changed packages
31 # only detect packages with changes
32 PKG_ROOTS=$(find . -name Makefile | \
33 grep -v ".*/src/Makefile" | \
34 sed -e 's@./\(.*\)/Makefile@\1/@')
35 CHANGES=$(git diff --diff-filter=d --name-only origin/$BRANCH...)
37 for ROOT in $PKG_ROOTS; do
38 for CHANGE in $CHANGES; do
39 if [[ "$CHANGE" == "$ROOT"* ]]; then
40 if grep -q '$(AUTORELEASE)' "$ROOT/Makefile"; then
41 CONTAINS_AUTORELEASE+="$ROOT"
48 if [ -n "$CONTAINS_AUTORELEASE" ]; then
49 cat > "$GITHUB_WORKSPACE/pr_comment.md" << EOF
50 Please do no longer set *PKG_RELEASE* to *AUTORELEASE* as the
51 feature is deprecated. Please use an integer instead. Below is a
52 list of affected packages including correct *PKG_RELEASE*:
56 echo "No usage of *AUTORELEASE* found in changes" > "$GITHUB_WORKSPACE/pr_comment.md"
59 for ROOT in $CONTAINS_AUTORELEASE; do
60 echo -n " - ${ROOT}Makefile: PKG_RELEASE:=" >> "$GITHUB_WORKSPACE/pr_comment.md"
61 last_bump="$(git log --pretty=format:'%h %s' "$ROOT" |
62 grep --max-count=1 -e ': [uU]pdate to ' -e ': [bB]ump to ' |
65 if [ -n "$last_bump" ]; then
66 echo -n $(($(git rev-list --count "$last_bump..HEAD" "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md"
68 echo -n $(($(git rev-list --count HEAD "$ROOT") + 2)) >> "$GITHUB_WORKSPACE/pr_comment.md"
70 echo >> "$GITHUB_WORKSPACE/pr_comment.md"
74 uses: peter-evans/find-comment@v2
77 issue-number: ${{ github.event.pull_request.number }}
78 comment-author: 'github-actions[bot]'
80 - name: Create or update comment
81 uses: peter-evans/create-or-update-comment@v2
83 comment-id: ${{ steps.fc.outputs.comment-id }}
84 issue-number: ${{ github.event.pull_request.number }}
85 body-file: 'pr_comment.md'