Skip to content

Commit

Permalink
GHA: Comment dev build numbers on PR after merge (#510)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jorisroovers authored Jun 23, 2023
1 parent 0f5ed5c commit de7f8e2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
4 changes: 4 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit de7f8e2

Please sign in to comment.