Skip to content

Commit

Permalink
Merge pull request #58 from bcgov-nr/feat/actionNextStepMessages
Browse files Browse the repository at this point in the history
feat: action next step messages
  • Loading branch information
mbystedt authored Jun 5, 2024
2 parents 4464b7b + c54855d commit 77c89d8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": ["plugin:prettier/recommended"],
"parserOptions": {
"ecmaVersion": 14,
"ecmaVersion": 2015,
"sourceType": "module"
}
}
56 changes: 55 additions & 1 deletion generators/gh-maven-build/templates/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
name: Build and release
runs-on: ubuntu-latest
<% if (unitTestsPath) { -%>
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
needs: test
<% } -%>
permissions:
Expand Down Expand Up @@ -161,3 +160,58 @@ jobs:
uses: bcgov-nr/action-broker-intention-close@v1
with:
intention_token: ${{ env.INTENTION_TOKEN }}
message:
name: Message
needs: build-release
steps:
- name: Pull request
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
uses: actions/github-script@v7
with:
script: |
// Get a list of all issues created by the PR opener
// See: https://octokit.github.io/rest.js/#pagination
const creator = context.payload.sender.login
const opts = github.rest.issues.listForRepo.endpoint.merge({
...context.issue,
creator,
state: 'all'
})
const issues = await github.paginate(opts)
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `This build is ready to be deployed up to the test environment using the 'Deploy' action. After merging to main, create a release in GitHub to deploy to production.`
})
for (const issue of issues) {
if (issue.number === context.issue.number) {
continue
}
if (issue.pull_request) {
return // Creator is already a contributor.
}
}
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `**Welcome**, new contributor!
Please make sure you've read our [contributing guide](CONTRIBUTING.md). We look forward to reviewing your pull request shortly.`
})
- name: Release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `This build is ready to be deployed using the 'Deploy' action. After approval, it can be deployed to production.`
})

0 comments on commit 77c89d8

Please sign in to comment.