diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7698c9494..e39ad00b5 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,6 +12,11 @@ - ✅ Provide tests for your changes. - 📝 Use descriptive commit messages. - 📗 Update any related documentation and include any relevant screenshots. + + NOTE: Pull Requests from forked repositories will need to be reviewed by + a Forem Team member before any CI builds will run. Once your PR is approved + with a `/ci` reply to the PR, it will be allowed to run subsequent builds without + manual approval. --> ## What type of PR is this? (check all applicable) diff --git a/.github/workflows/buildkite.yml b/.github/workflows/buildkite.yml new file mode 100644 index 000000000..ed6b08546 --- /dev/null +++ b/.github/workflows/buildkite.yml @@ -0,0 +1,35 @@ +name: Approve PR for running Buildkite pipelines + +on: + issue_comment: + types: [created] + +jobs: + add_ci_label: + name: "Add CI label to PR" + if: github.event.issue.pull_request != '' && + startsWith(github.event.comment.body, '/ci') && + (github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'OWNER') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-ecosystem/action-add-labels@v1 + with: + github_token: ${{ secrets.github_token }} + labels: ci + + build_containers: + name: "Run Buildkite forem/build-containers pipeline" + if: github.event.issue.pull_request != '' && + startsWith(github.event.comment.body, '/ci') && + (github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'OWNER') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: jdoss/trigger-pipeline-action@c1c77c83b3c16b03b474bc2e1ce6eb36dbde7f3d + env: + BUILDKITE_API_ACCESS_TOKEN: ${{ secrets.buildkite_api_access_token }} + PIPELINE: "forem/build-containers" + PULL_REQUEST_ID: ${{github.event.issue.number} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000..8f9dc7542 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,23 @@ +name: Comment on PR + +on: + pull_request_target: + +jobs: + if: github.repository != 'forem/forem' + pull_request_comment: + runs-on: ubuntu-latest + steps: + - name: Add comment to PR if coming from third-party fork + uses: mshick/add-pr-comment@v1 + with: + message: | + Thank you for opening this PR! We appreciate you! + + For all pull requests coming from third-party forks we will need to + review the PR before we can process it through our CI pipelines. + + A Forem Team member will review this contribution and get back to + you as soon as possible! + repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token-user-login: 'github-actions[bot]'