Skip to content

Commit

Permalink
Update assign-milestone-on-close.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaCowley authored Aug 22, 2024
1 parent 2d3d44e commit 9ab8688
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions .github/workflows/assign-milestone-on-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ jobs:
assign-milestone:
runs-on: ubuntu-latest
steps:
- name: Get payload content
id: payload-content
uses: actions/github-script@v7
with:
script: console.log(JSON.stringify(context.payload));
# result-encoding: string
# - name: Print payload content
# id: print-payload
# run: |
# echo "${{steps.get-payload.outputs.result}}" >> payload.txt
- name: Check if milestone is set
id: check-milestone
uses: actions/github-script@v7
Expand All @@ -36,10 +26,8 @@ jobs:
const issueOrPr = context.payload.issue || context.payload.pull_request;
if (!issueOrPr.milestone) {
core.setOutput('milestoneNotSet', 'true');
console.log("Milestone not set");
} else {
core.setOutput('milestoneNotSet', 'false');
console.log("Milestone already set.");
}
- name: Check completed or merged
Expand All @@ -48,18 +36,15 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
// No need to check if this is a merged PR, as pull_request_target takes care of that for us.
if ((context.payload.issue && context.payload.issue.state_reason === "completed") || (context.payload.pull_request && context.payload.pull_request.merged === true)) {
if ((context.payload.issue && context.payload.issue.state_reason === "completed")
|| (context.payload.pull_request && context.payload.pull_request.merged === true)) {
core.setOutput('isDone', 'true');
console.log("Done.");
} else {
core.setOutput('isDone', 'false');
console.log("Not done.");
}
console.log((context.payload.issue && context.payload.issue.state_reason === "completed") || (context.payload.pull_request && context.payload.pull_request.merged === true));
- name: Assign default milestone
if: steps.check-milestone.outputs.milestoneNotSet == 'true' && steps.check-done.outputs.isDone== 'true'
if: steps.check-milestone.outputs.milestoneNotSet == 'true' && steps.check-done.outputs.isDone == 'true'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
Expand Down

0 comments on commit 9ab8688

Please sign in to comment.