From de7f8e2e7412be44f731e637d83bc3f51206c93a Mon Sep 17 00:00:00 2001 From: Joris Roovers Date: Fri, 23 Jun 2023 11:49:43 +0200 Subject: [PATCH] GHA: Comment dev build numbers on PR after merge (#510) Use GHA to leave a comment with on a PR after its merged with a link to the corresponding dev build on PyPI and instructions on how to install it. --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ .github/workflows/publish-release.yml | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b06c01fb..d2941a61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -238,3 +238,29 @@ jobs: secrets: inherit # pass all secrets (required to access secrets in a called workflow) with: docs_version: "dev" + + # After merging a PR, leave a comment on the PR with a link to the new dev build + notify: + needs: + - auto-publish-dev + if: github.ref == 'refs/heads/main' + runs-on: "ubuntu-latest" + steps: + - uses: actions/github-script@v6 + with: + script: | + const body = `Build \ + [${{ needs.auto-publish-dev.outputs.gitlint_version }}](https://pypi.org/project/gitlint/${{ needs.auto-publish-dev.outputs.gitlint_version }}) \ + is now available on PyPI! + + Install using: + \`\`\`sh + pip install gitlint==${{ needs.auto-publish-dev.outputs.gitlint_version }} + \`\`\` + `; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: body + }); \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 60961f0c..31e4dc9f 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -18,6 +18,10 @@ on: required: true type: string default: "latest_dev" + outputs: + gitlint_version: + description: "Gitlint version that was published" + value: ${{ jobs.publish.outputs.gitlint_version }} # Manually trigger a release workflow_dispatch: