mirror of
https://github.com/Homebrew/BrewUI.git
synced 2026-10-02 08:34:36 +08:00
check-issues.yml: update to match main configuration
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Adapted from Homebrew/brew: .github/workflows/check-issues.yml.
|
||||
# This file is synced from the `.github` repository, do not modify it directly.
|
||||
name: Check issues
|
||||
|
||||
on:
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
# Restrict this write-token workflow to repositories with supported templates.
|
||||
# The first step also fails if a repository checkout has occurred.
|
||||
if: >-
|
||||
github.repository == 'Homebrew/BrewUI' &&
|
||||
contains(fromJSON('["Homebrew/BrewUI", "Homebrew/brew", "Homebrew/homebrew-core", "Homebrew/homebrew-cask"]'), github.repository) &&
|
||||
github.event.issue.user.login != 'BrewTestBot' &&
|
||||
github.event.issue.user.login != 'dependabot[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
@@ -55,14 +55,25 @@ jobs:
|
||||
|
||||
- name: Fetch issue templates
|
||||
run: |
|
||||
gh api "repos/${GITHUB_REPOSITORY:?}/contents/.github/ISSUE_TEMPLATE?ref=main" \
|
||||
--jq '.[] | select(.type == "file" and (.name | test("\\.ya?ml$")) and .name != "config.yml") | .path' |
|
||||
while IFS= read -r template_path
|
||||
do
|
||||
gh api "repos/${GITHUB_REPOSITORY}/contents/${template_path}?ref=main" \
|
||||
--jq ".content" |
|
||||
base64 --decode >"${RUNNER_TEMP}/check-issues/templates/${GITHUB_REPOSITORY//\//-}-${template_path##*/}"
|
||||
done
|
||||
# Validate against the brew, homebrew-core and homebrew-cask templates so
|
||||
# issues transferred between these repositories are not closed for using a
|
||||
# sibling repository's (valid) template.
|
||||
template_repositories=(Homebrew/brew Homebrew/homebrew-core Homebrew/homebrew-cask)
|
||||
if [[ "${GITHUB_REPOSITORY}" == "Homebrew/BrewUI" ]]
|
||||
then
|
||||
template_repositories=("${GITHUB_REPOSITORY}")
|
||||
fi
|
||||
for repo in "${template_repositories[@]}"
|
||||
do
|
||||
gh api "repos/${repo}/contents/.github/ISSUE_TEMPLATE?ref=main" \
|
||||
--jq '.[] | select(.type == "file" and (.name | test("\\.ya?ml$")) and .name != "config.yml") | .path' |
|
||||
while IFS= read -r template_path
|
||||
do
|
||||
gh api "repos/${repo}/contents/${template_path}?ref=main" \
|
||||
--jq ".content" |
|
||||
base64 --decode >"${RUNNER_TEMP}/check-issues/templates/${repo//\//-}-${template_path##*/}"
|
||||
done
|
||||
done
|
||||
|
||||
- name: Fetch template checker
|
||||
run: |
|
||||
@@ -76,7 +87,8 @@ jobs:
|
||||
ISSUE_TITLE: ${{ github.event.issue.title }}
|
||||
run: |
|
||||
# Released apps attach a crash report instead of filling in the issue form.
|
||||
if [[ "${ISSUE_TITLE}" == "Crash: "* ]] &&
|
||||
if [[ "${GITHUB_REPOSITORY}" == "Homebrew/BrewUI" &&
|
||||
"${ISSUE_TITLE}" == "Crash: "* ]] &&
|
||||
grep -q '^<summary>Automatic crash report</summary>[[:space:]]*$' "${RUNNER_TEMP}/check-issues/body" &&
|
||||
grep -q '^Homebrew[.]app crash report[[:space:]]*$' "${RUNNER_TEMP}/check-issues/body"
|
||||
then
|
||||
|
||||
Reference in New Issue
Block a user