Update actions/setup-java action to v4 #245
Workflow file for this run
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: Repo / Auto-apply milestone | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- reopened | |
jobs: | |
milestone: | |
name: Apply milestone | |
runs-on: ubuntu-22.04 | |
if: ${{ contains(github.repository_owner, 'jellyfin') }} | |
steps: | |
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | |
with: | |
github-token: ${{ secrets.JF_BOT_TOKEN }} | |
script: | | |
const owner = context.repo.owner; | |
const repo = context.repo.repo; | |
const pr_id = context.issue.number; | |
let response = await github.rest.issues.get({ | |
owner, | |
repo, | |
issue_number: pr_id, | |
}); | |
const pr = response.data; | |
if (pr.milestone !== null) { | |
return; | |
} | |
response = await github.rest.issues.listMilestones({ | |
owner, | |
repo, | |
state: 'open', | |
}); | |
const milestones = response.data; | |
// Find first open milestone | |
const milestone = milestones.reduce( | |
(prev, current) => prev?.number < current.number ? prev : current, | |
null, | |
); | |
if (milestone === null) { | |
console.warn('No suitable milestone found, aborting.'); | |
return; | |
} | |
console.log(`Found milestone to apply: ${milestone.title}`); | |
await github.rest.issues.update({ | |
owner, | |
repo, | |
issue_number: pr_id, | |
milestone: milestone.number, | |
}); | |
console.log(`Successfully applied milestone ${milestone.title} to PR #${pr_id}`); |