mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 19:04:38 +00:00
chore: new workflow to tag issues before 2021 to prepare for cleanup - github issues management (#24098)
* new workflow to tag issues before 2021 to prepare for cleanup * add argument to curl * isolate labeling action + add closing action * chore: fix prettier errors --------- Co-authored-by: Simone Taeggi <startae14@gmail.com>
This commit is contained in:
parent
2a9b9b61cf
commit
660026a706
41
.github/workflows/close_stale_issues.yml
vendored
Normal file
41
.github/workflows/close_stale_issues.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
name: Close Pre-2021 Issues
|
||||
on:
|
||||
workflow_dispatch: # Allows manual triggering from the Github UI
|
||||
|
||||
permissions:
|
||||
issues: write # Required to close issues and post comments
|
||||
contents: read # Needed by most GitHub Actions
|
||||
pull-requests: read # Needed to access PR data
|
||||
|
||||
jobs:
|
||||
close-inactive:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Close stale old issues
|
||||
uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-labels: 'stale-before-2021' # Only process issues with this label
|
||||
exempt-issue-labels: 'issue: security,severity: critical,severity: high' # Don't close issues with this label
|
||||
exempt-all-milestones: true # Don't close issues that are part of a milestone
|
||||
days-before-stale: 0 # Mark as stale immediately
|
||||
days-before-close: 0 # Close immediately
|
||||
operations-per-run: 100
|
||||
stale-issue-message: |
|
||||
👋 Hello there!
|
||||
|
||||
We noticed this issue was created before 2024. As part of our efforts to keep our issue tracker current and actionable, we are closing older issues that have been inactive.
|
||||
|
||||
This issue has been automatically closed due to inactivity. If this issue is still relevant:
|
||||
- Please add a comment to let us know and we will reopen it.
|
||||
- Share any updates or additional context.
|
||||
|
||||
Thank you for your contribution to making Strapi better! 🙏
|
||||
50
.github/workflows/label_stale_issues.yml
vendored
Normal file
50
.github/workflows/label_stale_issues.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
name: Label Pre-2021 Issues
|
||||
on:
|
||||
workflow_dispatch: # Allows manual triggering from the Github UI
|
||||
|
||||
permissions:
|
||||
issues: write # Required to close issues and post comments
|
||||
contents: read # Needed by most GitHub Actions
|
||||
pull-requests: read # Needed to access PR data
|
||||
|
||||
jobs:
|
||||
close-inactive:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Label old issues
|
||||
run: |
|
||||
# Set the cutoff date (issues created before this date will be labeled)
|
||||
CUTOFF_DATE="2021-01-01"
|
||||
LABEL="stale-before-2021"
|
||||
|
||||
echo "Labeling issues created before $CUTOFF_DATE with $LABEL"
|
||||
|
||||
# Get all open issues created before the cutoff date
|
||||
# Exclude issues with 'severity: high' or 'severity: critical' and 'issue: security' label and issues in milestones
|
||||
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/issues?state=open&per_page=100" | \
|
||||
jq -r --arg cutoff "$CUTOFF_DATE" --arg label "$LABEL" '
|
||||
.[] |
|
||||
select(.created_at < $cutoff) |
|
||||
select(.pull_request == null) |
|
||||
select(any(.labels[]?; .name == "severity: high") | not) |
|
||||
select(any(.labels[]?; .name == "severity: critical") | not) |
|
||||
select(any(.labels[]?; .name == "issue: security") | not) |
|
||||
select(.milestone == null) |
|
||||
select(any(.labels[]?; .name == $label) | not) |
|
||||
.number
|
||||
' | while read issue_number; do
|
||||
if [ ! -z "$issue_number" ]; then
|
||||
echo "Labeling issue #$issue_number with $label"
|
||||
|
||||
# Add the stale-before-2021 label
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/issues/$issue_number/labels" \
|
||||
-d "{\"labels\": [\"$label\"]}"
|
||||
|
||||
echo "Labeled issue #$issue_number"
|
||||
fi
|
||||
done
|
||||
Loading…
x
Reference in New Issue
Block a user