diff --git a/.eslintrc.json b/.eslintrc.json index f53b2b7..ea84b49 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,7 @@ { "extends": ["plugin:prettier/recommended"], "parserOptions": { - "ecmaVersion": 14, + "ecmaVersion": 2015, "sourceType": "module" } } diff --git a/generators/gh-maven-build/templates/build-release.yaml b/generators/gh-maven-build/templates/build-release.yaml index ecef9a6..c7b0296 100644 --- a/generators/gh-maven-build/templates/build-release.yaml +++ b/generators/gh-maven-build/templates/build-release.yaml @@ -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: @@ -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.` + }) \ No newline at end of file