mirror of
https://github.com/Mibew/simple-icons.git
synced 2024-11-16 10:24:12 +03:00
62 lines
2.2 KiB
YAML
62 lines
2.2 KiB
YAML
name: Autocloser
|
|
on:
|
|
issues:
|
|
# we allow 'reopend' and 'edited' in case the issue was closed by accident
|
|
types: [opened]
|
|
|
|
jobs:
|
|
run:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- id: match-java
|
|
name: Match Java
|
|
env:
|
|
ISSUE_TITLE: ${{ github.event.issue.title }}
|
|
# if the title contains the word Java (case insensitive)
|
|
# we make sure that this word is the end of the string or is followed by a space character (ex. we do not want to match javascript)
|
|
# we make sure that this word is the beginning of the string or is preceded by a space character (ex. we do not want to match foojava)
|
|
run: |
|
|
if [[ "$ISSUE_TITLE" =~ (^|[[:space:]])([jJ][aA][vV][aA])([[:space:]]|$) ]]; then
|
|
echo "match=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- id: get-labels
|
|
uses: ./.github/actions/get-labels
|
|
with:
|
|
issue_number: ${{ github.event.issue.number }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# if the issue is labeled as a 'new icon' and it matches Java, we
|
|
# - add a comment referring to the removal request
|
|
# - we add the 'duplicate' label
|
|
# - we close the issue
|
|
- name: Close the issue
|
|
if: |
|
|
steps.match-java.outputs.match == 'true' &&
|
|
contains(steps.get-labels.outputs.labels, 'new icon')
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: 'This issue was automatically closed. Please refer to #7374.'
|
|
})
|
|
github.rest.issues.addLabels({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
labels: ['duplicate']
|
|
})
|
|
github.rest.issues.update({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
state: 'closed',
|
|
state_reason: 'not_planned'
|
|
});
|