diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..f32f7f7 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,43 @@ +name: "Lint PR" + +on: + pull_request: + types: ["opened", "synchronize", "reopened", "edited"] + branches: [ "main" ] + +permissions: + pull-requests: write + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - uses: amannn/action-semantic-pull-request@v5 + id: lint_pr_title + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: marocchino/sticky-pull-request-comment@v2 + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! 👋🏼 + + We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true \ No newline at end of file diff --git a/.github/workflows/pre-merge.yml b/.github/workflows/pre-merge.yml index a9b9ddb..1fcc8ce 100644 --- a/.github/workflows/pre-merge.yml +++ b/.github/workflows/pre-merge.yml @@ -15,6 +15,7 @@ concurrency: jobs: ci: + name: Build and Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -35,7 +36,13 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pylint-json2html + pip install pylint-json2html PyYAML jinja2-cli + + - name: Replace Config + run: | + cd tests/integration/core/config + jinja2 tigergraph_connection.yaml --format=yaml --strict -D TIGERGRAPH_HOST=${{ secrets.TIGERGRAPH_HOST }} -o temp.yaml + mv temp.yaml tigergraph_connection.yaml - name: Cache Poetry dependencies id: cache-poetry diff --git a/tests/integration/core/config/tigergraph_connection.yaml b/tests/integration/core/config/tigergraph_connection.yaml index 6530744..01d431b 100644 --- a/tests/integration/core/config/tigergraph_connection.yaml +++ b/tests/integration/core/config/tigergraph_connection.yaml @@ -1,3 +1,3 @@ -host: "http://34.31.117.27" +host: "{{ TIGERGRAPH_HOST }}" username: "tigergraph" password: "tigergraph"