Skip to content

Update/artifact version #1

Update/artifact version

Update/artifact version #1

Workflow file for this run

# Once a PR has been merged, this action adds it to the upcoming release.
#
# See https://github.com/google/web-stories-wp/issues/6301
name: Add milestone
on:
pull_request:
types:
- closed
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
ISSUE_REFERENCE_REGEX: \(#([0-9]+)\)
GITHUB_REPO_ID: 235435637
jobs:
add-milestone:
name: Add milestone
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event.pull_request.merged == true
steps:
# https://github.com/ZenHubIO/API#get-release-reports-for-a-repository
# https://github.com/ZenHubIO/API#add-or-remove-issues-to-or-from-a-release-report
- name: Get next release
id: release
run: |
echo "Getting list of releases from ZenHub"
RELEASES=$(curl -s -H "X-Authentication-Token: $ZENHUB_API_TOKEN" "https://api.zenhub.com/p1/repositories/${GITHUB_REPO_ID}/reports/releases")
NEXT_RELEASE=$((echo $RELEASES ) | jq -r 'first(sort_by(.desired_end_date) | .[] | select( .state == "open" )) | .release_id')
echo "Determined release with ID $NEXT_RELEASE to be the next one"
echo "::set-output name=release_id::$NEXT_RELEASE"
env:
ZENHUB_API_TOKEN: ${{ secrets.ZENHUB_API_TOKEN }}
# https://github.com/ZenHubIO/API#add-or-remove-issues-to-or-from-a-release-report
- name: Add PR to release
run: |
echo "Adding PR $PR_NUMBER to release $RELEASE_ID"
curl -s -H "X-Authentication-Token: $ZENHUB_API_TOKEN" -H 'Content-Type: application/json' -X PATCH "https://api.zenhub.com/p1/reports/release/${RELEASE_ID}/issues" -d '{ "add_issues": [{ "repo_id": '"$GITHUB_REPO_ID"', "issue_number": '"$PR_NUMBER"' }], "remove_issues": [] }'
env:
ZENHUB_API_TOKEN: ${{ secrets.ZENHUB_API_TOKEN }}
RELEASE_ID: ${{ steps.release.outputs.release_id }}