chore: bump golang from 1.25 to 1.26 in /backend #66
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Automation | |
| on: | |
| pull_request: | |
| types: [opened] | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| add-issue-reference: | |
| if: github.repository == 'traP-jp/1m25_10' | |
| timeout-minutes: 3 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Extract issue number from branch name | |
| id: extract_issue | |
| run: | | |
| BRANCH_NAME="${{ github.head_ref }}" | |
| if [[ $BRANCH_NAME =~ ^[a-zA-Z0-9]+/([0-9]+)- ]]; then | |
| ISSUE_NUMBER=${BASH_REMATCH[1]} | |
| echo "Issue number extracted: $ISSUE_NUMBER" | |
| echo "issue_number=$ISSUE_NUMBER" >> $GITHUB_OUTPUT | |
| else | |
| echo "Branch name '${BRANCH_NAME}' does not follow the expected format '<prefix>/<number>-<description>'. Skipping issue extraction." | |
| echo "issue_number=" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Update PR Description | |
| if: steps.extract_issue.outputs.issue_number | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| ISSUE_NUMBER: ${{ steps.extract_issue.outputs.issue_number }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| CURRENT_BODY=$(gh pr view "$PR_NUMBER" --json body --jq .body) | |
| if [[ "$CURRENT_BODY" == *"#${ISSUE_NUMBER}"* ]]; then | |
| echo "PR body already contains '#${ISSUE_NUMBER}'. No update needed." | |
| exit 0 | |
| fi | |
| CLOSES_TEXT="Closes #${ISSUE_NUMBER}" | |
| if [ -z "$CURRENT_BODY" ]; then | |
| UPDATED_BODY="$CLOSES_TEXT" | |
| else | |
| UPDATED_BODY="$(printf '%s\n\n---\n%s' "$CURRENT_BODY" "$CLOSES_TEXT")" | |
| fi | |
| echo "Updating PR #${PR_NUMBER} body." | |
| gh pr edit "$PR_NUMBER" --body "$UPDATED_BODY" | |
| auto-assignment: | |
| if: >- | |
| github.repository == 'traP-jp/1m25_10' && | |
| github.event.action == 'opened' && | |
| endsWith(github.actor, '[bot]') == false | |
| timeout-minutes: 3 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Add event actor to assignees | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| ASSIGNEE_COUNT=$(gh pr view "$PR_NUMBER" --json assignees --jq '(.assignees | length)') | |
| if [ "$ASSIGNEE_COUNT" -eq 0 ]; then | |
| echo "No assignees found. Assigning the author: ${{ github.actor }}" | |
| gh pr edit "$PR_NUMBER" --add-assignee "${{ github.actor }}" | |
| else | |
| echo "This PR already has $ASSIGNEE_COUNT assignee(s). Skipping." | |
| fi |