Skip to content

Commit de7f8e2

Browse files
authored
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.
1 parent 0f5ed5c commit de7f8e2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,29 @@ jobs:
238238
secrets: inherit # pass all secrets (required to access secrets in a called workflow)
239239
with:
240240
docs_version: "dev"
241+
242+
# After merging a PR, leave a comment on the PR with a link to the new dev build
243+
notify:
244+
needs:
245+
- auto-publish-dev
246+
if: github.ref == 'refs/heads/main'
247+
runs-on: "ubuntu-latest"
248+
steps:
249+
- uses: actions/github-script@v6
250+
with:
251+
script: |
252+
const body = `Build \
253+
[${{ needs.auto-publish-dev.outputs.gitlint_version }}](https://pypi.org/project/gitlint/${{ needs.auto-publish-dev.outputs.gitlint_version }}) \
254+
is now available on PyPI!
255+
256+
Install using:
257+
\`\`\`sh
258+
pip install gitlint==${{ needs.auto-publish-dev.outputs.gitlint_version }}
259+
\`\`\`
260+
`;
261+
github.rest.issues.createComment({
262+
issue_number: context.issue.number,
263+
owner: context.repo.owner,
264+
repo: context.repo.repo,
265+
body: body
266+
});

.github/workflows/publish-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
required: true
1919
type: string
2020
default: "latest_dev"
21+
outputs:
22+
gitlint_version:
23+
description: "Gitlint version that was published"
24+
value: ${{ jobs.publish.outputs.gitlint_version }}
2125

2226
# Manually trigger a release
2327
workflow_dispatch:

0 commit comments

Comments
 (0)