Element Template Runtime Versions #359
This file contains 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: ASSIGN_MILESTONE | |
on: | |
issues: | |
types: ['closed'] | |
pull_request: | |
types: ['closed'] | |
jobs: | |
check_permissions: | |
runs-on: ubuntu-latest | |
name: Check Repo Permission | |
outputs: | |
permission: ${{ steps.checkPermissions.outputs.PERMISSION }} | |
steps: | |
- name: Check Permissions | |
id: checkPermissions | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
PERMISSION=$(gh api \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}/permission \ | |
--jq '.permission') | |
echo "PERMISSION=$PERMISSION" >> $GITHUB_OUTPUT | |
assign_milestone: | |
runs-on: ubuntu-latest | |
name: Assign Milestone | |
needs: check_permissions | |
if: | | |
needs.check_permissions.outputs.permission == 'admin' || | |
needs.check_permissions.outputs.permission == 'write' | |
steps: | |
- name: Get current Milestone | |
id: getMilestone | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
# Fetch the list of milestones for the repository | |
# Filter for milestones that start with 'M' and are open | |
MILESTONE=$(gh api -H "Accept: application/vnd.github.v3+json" \ | |
/repos/${{ github.repository }}/milestones \ | |
--jq '[.[] | select(.title | startswith("M")) | .number ][0]' | |
) | |
echo "MILESTONE_NUMBER=$MILESTONE" >> $GITHUB_OUTPUT | |
- name: Assign Issue | |
if: | | |
github.event.issue && | |
github.event.issue.state_reason != 'not_planned' && | |
github.event.issue.milestone == null | |
env: | |
MILESTONE_NUMBER: ${{steps.getMilestone.outputs.MILESTONE_NUMBER}} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api \ | |
--method PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/${{ github.repository }}/issues/${{github.event.issue.number}} \ | |
-F "milestone=$MILESTONE_NUMBER" | |
- name: Assign PR | |
if: | | |
github.event.pull_request && | |
github.event.pull_request.merged_at && | |
github.event.pull_request.milestone == null | |
env: | |
MILESTONE_NUMBER: ${{steps.getMilestone.outputs.MILESTONE_NUMBER}} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api \ | |
--method PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/${{ github.repository }}/issues/${{github.event.pull_request.number}} \ | |
-F "milestone=$MILESTONE_NUMBER" |