Update dependencies #169
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
on: | |
pull_request: | |
branches: [master] | |
types: [closed] | |
jobs: | |
set-milestone: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Compute milestone | |
run: | | |
echo "MILESTONE_NUMBER=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec | cut -d- -f1)" >> $GITHUB_ENV | |
- name: Set milestone | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
// Get milestone | |
const milestone = process.env.MILESTONE_NUMBER | |
console.log(`Using milestone with name ${milestone}`) | |
// Check if milestone exists | |
const issuesGetMilestonesParams = context.repo | |
// Search if milestone is already defined | |
const response = await github.issues.listMilestones(issuesGetMilestonesParams) | |
let githubMilestone = response.data.find(milestoneResponse => milestoneResponse.title === milestone) | |
// Create if doesn't exist | |
if (!githubMilestone) { | |
const issuesCreateMilestoneParams = { owner: context.repo.owner, repo:context.repo.repo, title: milestone } | |
const createMilestoneResponse = await github.issues.createMilestone(issuesCreateMilestoneParams) | |
githubMilestone = createMilestoneResponse.data | |
} | |
// Grab the milestone number | |
const milestoneNumber = githubMilestone.number | |
// Sets the milestone from the number | |
const issuesUpdateParams = { owner: context.repo.owner, repo: context.repo.repo, milestone: milestoneNumber, issue_number: context.issue.number } | |
await github.issues.update(issuesUpdateParams) |