From 23b7b8cc764f33ffc292237ccc0fe2c37fba5afb Mon Sep 17 00:00:00 2001 From: Sarah Dutkiewicz Date: Wed, 1 Mar 2023 10:36:39 -0500 Subject: [PATCH 1/3] Working through build issues for new contributors --- .github/workflows/build.yml | 27 ++++++++++++------- .github/workflows/comment-on-pr.yml | 40 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/comment-on-pr.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb307ffa..9507b619 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,16 +7,11 @@ on: pull_request: branches: [ main ] -permissions: write-all -# pull-requests: write-all - jobs: build: runs-on: ubuntu-latest - - steps: - uses: actions/checkout@v3 - name: Setup .NET Core @@ -45,9 +40,23 @@ jobs: format: 'markdown' output: 'both' - - name: Add Coverage PR Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' + - name: Upload code coverage results artifact + uses: actions/upload-artifact@v3 + if: success() || failure() with: - recreate: true + name: code-coverage-results path: code-coverage-results.md + + - name: Save the PR number in an artifact + if: github.event_name == 'pull_request' && (success() || failure()) + shell: bash + env: + PR_NUMBER: ${{ github.event.number }} + run: echo $PR_NUMBER > pr-number.txt + + - name: Upload the PR number + uses: actions/upload-artifact@v3 + if: github.event_name == 'pull_request' && (success() || failure()) + with: + name: pr-number + path: ./pr-number.txt diff --git a/.github/workflows/comment-on-pr.yml b/.github/workflows/comment-on-pr.yml new file mode 100644 index 00000000..6f42f756 --- /dev/null +++ b/.github/workflows/comment-on-pr.yml @@ -0,0 +1,40 @@ +name: Comment on the Pull Request + +# read-write repo token +# See: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ +on: + workflow_run: + workflows: [".NET Core"] + types: + - completed + +jobs: + comment: + runs-on: ubuntu-latest + + # Only comment on the PR if this is a PR event + if: github.event.workflow_run.event == 'pull_request' + + steps: + - name: Get the PR Number artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + workflow_conclusion: "" + name: pr-number + - name: Read PR Number into GitHub environment variables + run: echo "PR_NUMBER=$(cat pr-number.txt)" >> $GITHUB_ENV + - name: Confirm the PR Number (Debugging) + run: echo $PR_NUMBER + - name: Get the code coverage results file + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + workflow_conclusion: "" + name: code-coverage-results + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + with: + number: ${{ env.PR_NUMBER }} + recreate: true + path: code-coverage-results.md From 5936e01e7bc01f5e8d1c5c258192579586a3067d Mon Sep 17 00:00:00 2001 From: Sarah Dutkiewicz Date: Wed, 1 Mar 2023 11:51:34 -0500 Subject: [PATCH 2/3] minor text change in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a58967b..0ce963e9 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ public class Order - **Guard.Against.NullOrEmpty** (throws if string, guid or array input is null or empty) - **Guard.Against.NullOrWhiteSpace** (throws if string input is null, empty or whitespace) - **Guard.Against.OutOfRange** (throws if integer/DateTime/enum input is outside a provided range) -- **Guard.Against.EnumOutOfRange** (throws if a enum value is outside a provided Enum range) +- **Guard.Against.EnumOutOfRange** (throws if an enum value is outside a provided Enum range) - **Guard.Against.OutOfSQLDateRange** (throws if DateTime input is outside the valid range of SQL Server DateTime values) - **Guard.Against.Zero** (throws if number input is zero) From 79839a70da6741d614ea7db3b98a333b39c4d7f4 Mon Sep 17 00:00:00 2001 From: Sarah Dutkiewicz Date: Wed, 1 Mar 2023 12:44:51 -0500 Subject: [PATCH 3/3] Adding retention days to the artifact uploads --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9507b619..f34bba7a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,6 +46,7 @@ jobs: with: name: code-coverage-results path: code-coverage-results.md + retention-days: 1 - name: Save the PR number in an artifact if: github.event_name == 'pull_request' && (success() || failure()) @@ -60,3 +61,4 @@ jobs: with: name: pr-number path: ./pr-number.txt + retention-days: 1 \ No newline at end of file