Skip to content

Create GitHub Action to label current sprint issues (#1420)#1422

Merged
sven1103 merged 1 commit intomainfrom
feature/label-sprint-issues
Apr 21, 2026
Merged

Create GitHub Action to label current sprint issues (#1420)#1422
sven1103 merged 1 commit intomainfrom
feature/label-sprint-issues

Conversation

@sven1103
Copy link
Copy Markdown
Contributor

Description

This PR implements the GitHub Action requested in #1420 to automatically label issues that are part of the current sprint.

Features

  • Runs twice daily at 8 AM and 8 PM UTC (cron schedule)
  • Manual trigger support via workflow_dispatch for testing
  • Bidirectional sync:
    • Adds sprint:current label to issues in the current sprint
    • Removes sprint:current label from issues no longer in the sprint
  • Project Show errors on why the registration of a user fails #24 integration - checks sprint/iteration assignments
  • Auto-creates label if it doesn't exist (green color: #0E8A16)
  • Detailed logging for debugging and monitoring

Technical Details

Aspect Implementation
Workflow file .github/workflows/label_sprint_issues.yml
Permissions issues: write for labeling
Authentication Uses ISSUE_MANAGEMENT secret (same as existing project workflows)
Iteration detection Compares current date against sprint start/end dates

Testing

The workflow can be triggered manually for testing:

  1. Go to Actions tab
  2. Select "Label Current Sprint Issues"
  3. Click "Run workflow"

Checklist

  • Workflow runs on schedule (2x daily)
  • Graceful handling when no active sprint exists
  • Proper error handling and logging
  • Uses existing authentication pattern (ISSUE_MANAGEMENT secret)

Resolves #1420

@sven1103 sven1103 requested a review from a team as a code owner April 21, 2026 08:14
@sven1103 sven1103 self-assigned this Apr 21, 2026
@sven1103
Copy link
Copy Markdown
Contributor Author

I need to merge to test it

Copy link
Copy Markdown
Contributor

@KochTobi KochTobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to do what is requested. Hard to read but I could not find anything dangerous.

Comment on lines +4 to +8
schedule:
# Run twice daily: 8 AM and 8 PM UTC
- cron: "0 8 * * *"
- cron: "0 20 * * *"
workflow_dispatch: # Manual trigger for testing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why twice daily?


steps:
- name: Checkout repository
uses: actions/checkout@v5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be increased to checkout@v6


- name: Sync sprint labels
env:
GH_TOKEN: ${{ secrets.ISSUE_MANAGEMENT }}
Copy link
Copy Markdown
Contributor

@KochTobi KochTobi Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need a token here? The permission settings in the job should give the generated github token enough permissions. No need to maintain a second token.

Suggested change
GH_TOKEN: ${{ secrets.ISSUE_MANAGEMENT }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

see https://docs.github.com/en/actions/tutorials/authenticate-with-github_token

Comment on lines +56 to +63
CURRENT_SPRINT=$(cat project_items.json | jq -r --arg today "$TODAY" '
[.items[].iteration | select(. != null)] |
unique |
.[] |
select(.startDate <= $today and .duration.endDate >= $today) |
.id
' | head -1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this part.
What I gathered:
list items from file -> get date -> select all non null -> remove duplicates -> ? -> filter for date -> select the first

Comment on lines +65 to +68
echo "WARNING: No active sprint found for today ($TODAY)"
echo "Checking all iterations in project..."
cat project_items.json | jq -r '[.items[].iteration | select(. != null)] | unique | .[] | "\(.id): \(.title) (\(.startDate) to \(.duration.endDate))"' || true
echo "Exiting - no active sprint to process"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens here?

@sven1103-agent sven1103-agent force-pushed the feature/label-sprint-issues branch from 9f6bdea to 6d04a12 Compare April 21, 2026 09:03
- Runs twice daily (8 AM and 3 PM UTC)
- Syncs sprint:current label with Project #24 sprint assignments
- Adds label to issues in current sprint
- Removes label from issues no longer in sprint
- Supports manual workflow_dispatch trigger for testing
- Uses GITHUB_TOKEN instead of ISSUE_MANAGEMENT secret

Resolves #1420
@sven1103-agent sven1103-agent force-pushed the feature/label-sprint-issues branch from 6d04a12 to d9401c5 Compare April 21, 2026 10:55
@sven1103 sven1103 merged commit 46b37f7 into main Apr 21, 2026
5 checks passed
@sven1103 sven1103 deleted the feature/label-sprint-issues branch April 21, 2026 10:58
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create GH action to regularly check and label issues that are part of the current sprint

2 participants