diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml new file mode 100644 index 0000000..5b50d6f --- /dev/null +++ b/.github/workflows/pr-check.yaml @@ -0,0 +1,71 @@ +# Schema: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions +name: Verify Contribution Guidelines + +on: + pull_request: + branches: + - main + types: + - opened + - reopened + - edited + - synchronize + +env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MESSAGE: > + Thank you for your interest in this project! At this moment, we are not currently accepting community contributions in the form of PRs. + If you would like to make a proposal, + we will do our best to review it, implement it ourselves, and include it in the next release. + If enough proposals come through, we will certainly revisit this policy to make the package as useful as possible. + [Contribution Guidelines](https://github.com/verily-src/fhirpath-go/CONTRIBUTING.md). + + Thank you! 🙂 + +jobs: + pr-description: + name: Check PR Description + runs-on: ubuntu-latest + steps: + - name: Check PR description + id: check + env: + PR_AUTHOR: ${{ github.event.pull_request.user.login }} + run: | + body="${PR_AUTHOR}" + body=$(echo "${body}" | sed -E -e '/OliverCardoza|bitwizeshift|VickSuresh|assefamaru|jonhayesverily|alexlaurinmath|Copybara/!d') + + if [ -z "$body"]; then + echo "status=failure" >> "${GITHUB_OUTPUT}" + else + echo "status=success" >> "${GITHUB_OUTPUT}" + fi + + # This stage is used to see whether we want to delete the comment once the + # problem has been resolved. + - name: Check for existing comment + id: comment + if: steps.check.outputs.status == 'failure' + continue-on-error: true + env: + PR_NUM: ${{ github.event.pull_request.number }} + run: | + # Check if comment already exists + comment_id=$(gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "repos/verily-src/verily1/issues/${{ env.PR_NUM }}/comments" \ + --jq ".[] | select(.body | contains(\"${{ env.MESSAGE }}\")) | .id") + + echo "id=${comment_id}" >> "${GITHUB_OUTPUT}" + + - name: Post comment + env: + PR_NUM: ${{ github.event.pull_request.number }} + PR_URL: ${{ github.event.pull_request.html_url }} + AUTHOR: "@${{ github.event.pull_request.user.login }}" + if: steps.check.outputs.status == 'failure' && steps.comment.outputs.id == '' + continue-on-error: true + run: | + gh pr comment "${{ env.PR_URL }}" -b "${{ env.AUTHOR }} ${{ env.MESSAGE }}" + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3ef0634 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# How to contribute + +## Reporting issues + +Bugs, feature requests, and development-related questions should be directed to our GitHub issue tracker. If reporting a bug, please try and provide as much context as possible such as your operating system, Go version, and anything else that might be relevant to the bug. For feature requests, please explain what you're trying to do, and how the requested feature would help you do that. + +## Pull Request + +We don't currently accept pull requests from the public. They will be automatically closed. If you would like to make a proposal, we will do our best to review it, implement it ourselves, and include it in the next release. If enough proposals come through, we will certainly revisit this policy to make the package as useful as possible. diff --git a/internal/containedresource/contained_resource_test.go b/internal/containedresource/contained_resource_test.go index 239470b..d085771 100644 --- a/internal/containedresource/contained_resource_test.go +++ b/internal/containedresource/contained_resource_test.go @@ -10,8 +10,8 @@ import ( dtpb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/datatypes_go_proto" bcrpb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/resources/bundle_and_contained_resource_go_proto" "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/resources/patient_go_proto" - "github.com/verily-src/fhirpath-go/internal/containedresource" "github.com/verily-src/fhirpath-go/internal/fhir" + "github.com/verily-src/fhirpath-go/internal/containedresource" "github.com/verily-src/fhirpath-go/internal/fhirtest" "github.com/verily-src/fhirpath-go/internal/resource" "google.golang.org/protobuf/proto" diff --git a/internal/element/canonical/canonical_test.go b/internal/element/canonical/canonical_test.go index 2299a40..484e813 100644 --- a/internal/element/canonical/canonical_test.go +++ b/internal/element/canonical/canonical_test.go @@ -9,8 +9,8 @@ import ( qpb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/resources/questionnaire_go_proto" "github.com/google/go-cmp/cmp" - "github.com/verily-src/fhirpath-go/internal/element/canonical" "github.com/verily-src/fhirpath-go/internal/fhir" + "github.com/verily-src/fhirpath-go/internal/element/canonical" "github.com/verily-src/fhirpath-go/internal/resource" "google.golang.org/protobuf/testing/protocmp" ) diff --git a/internal/element/extension/extension_example_test.go b/internal/element/extension/extension_example_test.go index adab42d..77745db 100644 --- a/internal/element/extension/extension_example_test.go +++ b/internal/element/extension/extension_example_test.go @@ -5,8 +5,8 @@ import ( dtpb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/datatypes_go_proto" "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/resources/task_go_proto" - "github.com/verily-src/fhirpath-go/internal/element/extension" "github.com/verily-src/fhirpath-go/internal/fhir" + "github.com/verily-src/fhirpath-go/internal/element/extension" ) func ExampleOverwrite() { diff --git a/internal/element/extension/extension_test.go b/internal/element/extension/extension_test.go index 6c0bb4b..d9b6fea 100644 --- a/internal/element/extension/extension_test.go +++ b/internal/element/extension/extension_test.go @@ -6,9 +6,9 @@ import ( dtpb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/datatypes_go_proto" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" + "github.com/verily-src/fhirpath-go/internal/fhir" "github.com/verily-src/fhirpath-go/internal/element/canonical" "github.com/verily-src/fhirpath-go/internal/element/extension" - "github.com/verily-src/fhirpath-go/internal/fhir" "github.com/verily-src/fhirpath-go/internal/fhirtest" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" diff --git a/internal/element/identifier/identifier_test.go b/internal/element/identifier/identifier_test.go index c2c2578..3c80396 100644 --- a/internal/element/identifier/identifier_test.go +++ b/internal/element/identifier/identifier_test.go @@ -7,8 +7,8 @@ import ( "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/codes_go_proto" dtpb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/datatypes_go_proto" "github.com/google/uuid" - "github.com/verily-src/fhirpath-go/internal/element/identifier" "github.com/verily-src/fhirpath-go/internal/fhir" + "github.com/verily-src/fhirpath-go/internal/element/identifier" "google.golang.org/protobuf/proto" ) diff --git a/internal/element/reference/reference_test.go b/internal/element/reference/reference_test.go index cb3c0fc..700b98f 100644 --- a/internal/element/reference/reference_test.go +++ b/internal/element/reference/reference_test.go @@ -9,8 +9,8 @@ import ( ppb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/resources/patient_go_proto" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/verily-src/fhirpath-go/internal/element/reference" "github.com/verily-src/fhirpath-go/internal/fhir" + "github.com/verily-src/fhirpath-go/internal/element/reference" "github.com/verily-src/fhirpath-go/internal/fhirtest" "github.com/verily-src/fhirpath-go/internal/resource" "google.golang.org/protobuf/testing/protocmp" diff --git a/internal/fhirtest/resources.go b/internal/fhirtest/resources.go index b1a0826..c80208f 100644 --- a/internal/fhirtest/resources.go +++ b/internal/fhirtest/resources.go @@ -7,8 +7,8 @@ import ( "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/datatypes_go_proto" "github.com/verily-src/fhirpath-go/internal/fhir" - "github.com/verily-src/fhirpath-go/internal/protofields" "github.com/verily-src/fhirpath-go/internal/resource" + "github.com/verily-src/fhirpath-go/internal/protofields" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" diff --git a/internal/slices/slices_test.go b/internal/slices/slices_test.go index c080d3c..097c077 100644 --- a/internal/slices/slices_test.go +++ b/internal/slices/slices_test.go @@ -5,9 +5,9 @@ import ( "strings" "testing" + dtpb "github.com/google/fhir/go/proto/google/fhir/proto/r4/core/datatypes_go_proto" "github.com/google/go-cmp/cmp" "github.com/verily-src/fhirpath-go/internal/slices" - "github.com/verily-src/fhirpath-go/internal/fhir" "golang.org/x/exp/constraints" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" @@ -61,6 +61,24 @@ type stringTestCase[T any] struct { expected string } +var ( + firstCoding = &dtpb.CodeableConcept{ + Coding: []*dtpb.Coding{ + { + System: &dtpb.Uri{Value: "test-system"}, + Code: &dtpb.Code{Value: "1"}, + }, + }, + } + secondCoding = &dtpb.CodeableConcept{ + Coding: []*dtpb.Coding{ + { + System: &dtpb.Uri{Value: "test-system"}, + Code: &dtpb.Code{Value: "2"}, + }, + }, + } +) func TestIsIdentical(t *testing.T) { type s1 []int type s2 []int @@ -257,8 +275,6 @@ func TestIncludes(t *testing.T) { } func TestIndexOf(t *testing.T) { - firstCoding := fhir.CodeableConcept("", fhir.Coding("test-system", "1")) - secondCoding := fhir.CodeableConcept("", fhir.Coding("test-system", "2")) firstProto := proto.Message(firstCoding) secondProto := proto.Message(secondCoding) testCases := []indexTestCase[any]{ @@ -568,8 +584,6 @@ func TestIsUnique_SimpleType(t *testing.T) { } func TestIsUnique_Proto(t *testing.T) { - firstCoding := fhir.CodeableConcept("", fhir.Coding("test-system", "1")) - secondCoding := fhir.CodeableConcept("", fhir.Coding("test-system", "2")) firstProto := proto.Message(firstCoding) secondProto := proto.Message(secondCoding) @@ -630,8 +644,6 @@ func TestUnique_SimpleType(t *testing.T) { } func TestUnique_Proto(t *testing.T) { - firstCoding := fhir.CodeableConcept("", fhir.Coding("test-system", "1")) - secondCoding := fhir.CodeableConcept("", fhir.Coding("test-system", "2")) firstProto := proto.Message(firstCoding) secondProto := proto.Message(secondCoding)