Skip to content

Commit

Permalink
Close milestone early to avoid late failures in the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Jan 9, 2025
1 parent 3e040d0 commit 23cf286
Showing 1 changed file with 33 additions and 32 deletions.
65 changes: 33 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,41 @@ jobs:
- name: Build samples
run: java src/Builder.java

close_github_milestone:
name: Close GitHub milestone
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Close GitHub milestone
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
result-encoding: string
script: |
const openMilestones = await github.rest.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
const [milestone] = openMilestones.data.filter(x => x.title === "${{ github.event.inputs.releaseVersion }}")
if (!milestone) {
throw new Error('Milestone "${{ github.event.inputs.releaseVersion }}" not found');
}
if (milestone.open_issues > 0) {
throw new Error(`Milestone "${{ github.event.inputs.releaseVersion }}" has ${milestone.open_issues} open issue(s)`);
}
const requestBody = {
owner: context.repo.owner,
repo: context.repo.repo,
milestone_number: milestone.number,
state: 'closed'
};
console.log(requestBody);
await github.rest.issues.updateMilestone(requestBody);
release_staging_repo:
name: Release staging repo
needs: [verify_reproducibility, verify_consumability]
needs: [verify_reproducibility, verify_consumability, close_github_milestone]
runs-on: ubuntu-latest
steps:
- name: Check out repository
Expand Down Expand Up @@ -142,37 +174,6 @@ jobs:
sudo apt-get update && sudo apt-get install --yes poppler-utils
pdfinfo /tmp/junit-user-guide.pdf
close_github_milestone:
name: Close GitHub milestone
needs: release_staging_repo
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Find milestone
id: milestoneNumber
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
result-encoding: string
script: |
const openMilestones = await github.rest.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
const [milestone] = openMilestones.data.filter(x => x.title === "${{ github.event.inputs.releaseVersion }}")
if (!milestone) {
throw new Error('Milestone "${{ github.event.inputs.releaseVersion }}" not found');
}
const requestBody = {
owner: context.repo.owner,
repo: context.repo.repo,
milestone_number: milestone.number,
state: 'closed'
};
console.log(requestBody);
await github.rest.issues.updateMilestone(requestBody);
wait_for_maven_central:
name: Wait for Maven Central
needs: release_staging_repo
Expand Down

0 comments on commit 23cf286

Please sign in to comment.