Skip to content

CI: don't install libsdl2, libsdl2-ttf #5082

CI: don't install libsdl2, libsdl2-ttf

CI: don't install libsdl2, libsdl2-ttf #5082

Workflow file for this run

name: Pull Request Renamer
on:
# zizmor: ignore[dangerous-triggers] This workflow won't work with `pull_request`, it would
# never be able to get the pull-requests:write permission it needs. `pull_request_target`
# is safe because the workflow has no secrets, no code is checked out, and there is no chance
# for code execution.
pull_request_target:
types:
- edited # PR's title was changed
- opened
- reopened
- synchronize # PR's branch was edited (i.e. new commits)
workflow_call:
concurrency:
group: pr-renamer-${{ github.head_ref || github.ref }}
cancel-in-progress: false # queue
jobs:
rename:
permissions:
pull-requests: write # gh pr edit
runs-on: ubuntu-latest
steps:
- id: title-massager
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
OLD_TITLE: ${{ github.event.pull_request.title }}
run: |
set -x
echo "OLD_TITLE=${OLD_TITLE}" >> "${GITHUB_OUTPUT}"
# Default to account for early successful termination
echo "NEW_TITLE=${OLD_TITLE}" >> "${GITHUB_OUTPUT}"
ALLOWED_TYPES="Chore|CI|Docs|Feature|Fix|Refactor"
# Ignore version numbers
if [[ "${OLD_TITLE}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
exit 0
fi
if [[ ! "${OLD_TITLE}" =~ ^[a-zA-Z()!-]+: ]]; then
echo "ERROR=No conventional commit type found. The allowed list is: ${ALLOWED_TYPES//|/, }" >> "${GITHUB_OUTPUT}"
exit 1
fi
NEW_TITLE="${OLD_TITLE}"
NEW_TITLE="$(echo "${OLD_TITLE}" | sed -r \
`# Strip scope` \
-e 's/^[a-z]+\(deps\)(!?:)/Chore:/i' \
-e 's/^([a-z]+)\([^)]+\)(!?:)/\1\2/i' \
`# Massage scope` \
-e 's/^[a-z]+!:/Breaking:/i' \
-e 's/^chore:/Chore:/i' \
-e 's/^ci:/CI:/i' \
-e 's/^docs:/Docs:/i' \
-e 's/^feat(ure)?:/Feature:/i' \
-e 's/^fix:/Fix:/i' \
-e 's/^ref(actor)?:/Refactor:/i')"
echo "${NEW_TITLE}"
# Lowercase the first letter of the description
#TYPE="$(echo "${NEW_TITLE}" | cut -d ':' -f 1)"
#FIRST_LETTER="$(echo "${NEW_TITLE}" | cut -d ':' -f 2 | awk '{$1=$1};1' | cut -c1 | tr [A-Z] [a-z])"
#REMAINING_LETTERS="$(echo "${NEW_TITLE}" | cut -d ':' -f 2 | awk '{$1=$1};1' | cut -c2-)"
#NEW_TITLE="${TYPE}: ${FIRST_LETTER}${REMAINING_LETTERS}"
# Restrict types
if [[ ! "${NEW_TITLE}" =~ ^${ALLOWED_TYPES}: ]]; then
echo "ERROR=This repository uses squash-merging, so it requires pull request titles to look like conventional commit messages. The pull request title must be prefixed with one of: ${ALLOWED_TYPES//|/, }" >> "${GITHUB_OUTPUT}"
exit 1
fi
echo "NEW_TITLE=${NEW_TITLE}" >> "${GITHUB_OUTPUT}"
- id: gh-pr-edit
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
NEW_TITLE: ${{ steps.title-massager.outputs.NEW_TITLE }}
run: gh pr edit "${{ github.event.pull_request.number }}" --title "${NEW_TITLE}"
- if: '!cancelled()'
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
message: |
## :x: Invalid pull request title
This pull request's title does not match the repository standards, and it cannot be automatically fixed. The error is:
```text
${{ steps.title-massager.outputs.ERROR }}
```
_Comment generated by the [${{ github.workflow }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}) workflow._
mode: ${{ steps.gh-pr-edit.outcome != 'success' && 'upsert' || 'delete' }}
create-if-not-exists: ${{ steps.gh-pr-edit.outcome != 'success' && 'true' || 'false' }}
comment-tag: pr-renamer
# !!! This check should be required by GitHub !!!
title-status-check:
needs:
- rename
if: always()
permissions: {}
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}