From ea5981db97a19600eb6067502417b319723fe2ea Mon Sep 17 00:00:00 2001 From: Malo Bourgon Date: Mon, 3 Feb 2020 15:55:17 -0800 Subject: [PATCH 1/6] Add example for Haskell Stack --- README.md | 1 + examples.md | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/README.md b/README.md index a0180c3..98be465 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ See [Examples](examples.md) for a list of `actions/cache` implementations for us - [Elixir - Mix](./examples.md#elixir---mix) - [Go - Modules](./examples.md#go---modules) - [Haskell - Cabal](./examples.md#haskell---cabal) +- [Haskell - Stack](./examples.md#haskell---stack) - [Java - Gradle](./examples.md#java---gradle) - [Java - Maven](./examples.md#java---maven) - [Node - npm](./examples.md#node---npm) diff --git a/examples.md b/examples.md index 15da4e3..17b153a 100644 --- a/examples.md +++ b/examples.md @@ -6,6 +6,7 @@ - [Elixir - Mix](#elixir---mix) - [Go - Modules](#go---modules) - [Haskell - Cabal](#haskell---cabal) + - [Haskell - Stack](#haskell---stack) - [Java - Gradle](#java---gradle) - [Java - Maven](#java---maven) - [Node - npm](#node---npm) @@ -130,6 +131,25 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba key: ${{ runner.os }}-${{ matrix.ghc }} ``` +## Haskell - Stack + +```yaml +- uses: actions/cache@v2 + name: Cache ~/.stack + with: + path: ~/.stack + key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} + restore-keys: | + ${{ runner.os }}-stack-global- +- uses: actions/cache@v2 + name: Cache .stack-work + with: + path: .stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }} + restore-keys: | + ${{ runner.os }}-stack-work- +``` + ## Java - Gradle ```yaml From 669e7536d9d7f814487469a7bb832ed71dd3b601 Mon Sep 17 00:00:00 2001 From: Vipul Date: Tue, 22 Feb 2022 12:17:37 +0530 Subject: [PATCH 2/6] Revert "Add example for Haskell Stack" --- README.md | 1 - examples.md | 20 -------------------- 2 files changed, 21 deletions(-) diff --git a/README.md b/README.md index 98be465..a0180c3 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,6 @@ See [Examples](examples.md) for a list of `actions/cache` implementations for us - [Elixir - Mix](./examples.md#elixir---mix) - [Go - Modules](./examples.md#go---modules) - [Haskell - Cabal](./examples.md#haskell---cabal) -- [Haskell - Stack](./examples.md#haskell---stack) - [Java - Gradle](./examples.md#java---gradle) - [Java - Maven](./examples.md#java---maven) - [Node - npm](./examples.md#node---npm) diff --git a/examples.md b/examples.md index 17b153a..15da4e3 100644 --- a/examples.md +++ b/examples.md @@ -6,7 +6,6 @@ - [Elixir - Mix](#elixir---mix) - [Go - Modules](#go---modules) - [Haskell - Cabal](#haskell---cabal) - - [Haskell - Stack](#haskell---stack) - [Java - Gradle](#java---gradle) - [Java - Maven](#java---maven) - [Node - npm](#node---npm) @@ -131,25 +130,6 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba key: ${{ runner.os }}-${{ matrix.ghc }} ``` -## Haskell - Stack - -```yaml -- uses: actions/cache@v2 - name: Cache ~/.stack - with: - path: ~/.stack - key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} - restore-keys: | - ${{ runner.os }}-stack-global- -- uses: actions/cache@v2 - name: Cache .stack-work - with: - path: .stack-work - key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }} - restore-keys: | - ${{ runner.os }}-stack-work- -``` - ## Java - Gradle ```yaml From ef145dd1347f1c56cb7d81773579c44fef80f626 Mon Sep 17 00:00:00 2001 From: Vipul Date: Mon, 28 Nov 2022 07:40:19 +0000 Subject: [PATCH 3/6] Add oncall logic to assign issues and PRs --- .github/auto_assign.yml | 21 --------------------- .github/workflows/add-reviewer-pr.yml | 16 ++++++++++++++++ .github/workflows/assign-issue.yml | 16 ++++++++++++++++ .github/workflows/auto-assign-issues.yml | 15 --------------- .github/workflows/auto-assign.yml | 10 ---------- 5 files changed, 32 insertions(+), 46 deletions(-) delete mode 100644 .github/auto_assign.yml create mode 100644 .github/workflows/add-reviewer-pr.yml create mode 100644 .github/workflows/assign-issue.yml delete mode 100644 .github/workflows/auto-assign-issues.yml delete mode 100644 .github/workflows/auto-assign.yml diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml deleted file mode 100644 index 6f0bf79..0000000 --- a/.github/auto_assign.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Set to true to add reviewers to pull requests -addReviewers: true - -# Set to true to add assignees to pull requests -addAssignees: false - -# A list of reviewers to be added to pull requests (GitHub user name) -reviewers: - - anuragc617 - - pallavx - - pdotl - - phantsure - - kotewar - - aparna-ravindra - - tiwarishub - - vsvipul - - bishal-pdmsft - -# A number of reviewers added to the pull request -# Set 0 to add all the reviewers (default: 0) -numberOfReviewers: 1 diff --git a/.github/workflows/add-reviewer-pr.yml b/.github/workflows/add-reviewer-pr.yml new file mode 100644 index 0000000..d4485fe --- /dev/null +++ b/.github/workflows/add-reviewer-pr.yml @@ -0,0 +1,16 @@ +name: Add Reviewer PR +on: + pull_request: + types: [opened] +jobs: + run-action: + runs-on: ubuntu-latest + steps: + - name: Get current oncall + id: oncall + run: | + echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT + + - name: add_reviewer + run: | + curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}' \ No newline at end of file diff --git a/.github/workflows/assign-issue.yml b/.github/workflows/assign-issue.yml new file mode 100644 index 0000000..185eb1d --- /dev/null +++ b/.github/workflows/assign-issue.yml @@ -0,0 +1,16 @@ +name: Assign issue +on: + issues: + types: [opened] +jobs: + run-action: + runs-on: ubuntu-latest + steps: + - name: Get current oncall + id: oncall + run: | + echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT + + - name: add_assignees + run: | + curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}' diff --git a/.github/workflows/auto-assign-issues.yml b/.github/workflows/auto-assign-issues.yml deleted file mode 100644 index 32c72f8..0000000 --- a/.github/workflows/auto-assign-issues.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Issue assignment - -on: - issues: - types: [opened] - -jobs: - auto-assign: - runs-on: ubuntu-latest - steps: - - name: 'Auto-assign issue' - uses: pozil/auto-assign-issue@v1.4.0 - with: - assignees: anuragc617,pallavx,pdotl,phantsure,kotewar,tiwarishub,aparna-ravindra,vsvipul,bishal-pdmsft - numOfAssignee: 1 diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml deleted file mode 100644 index d7161b1..0000000 --- a/.github/workflows/auto-assign.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 'Auto Assign' -on: - pull_request_target: - types: [opened, ready_for_review] - -jobs: - add-reviews: - runs-on: ubuntu-latest - steps: - - uses: kentaro-m/auto-assign-action@v1.2.1 From 651d82954ce3f1e75098342da9dca33df6289449 Mon Sep 17 00:00:00 2001 From: Vipul Date: Mon, 28 Nov 2022 16:18:36 +0530 Subject: [PATCH 4/6] Change pull_request to pull_request_target for PR review --- .github/workflows/add-reviewer-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/add-reviewer-pr.yml b/.github/workflows/add-reviewer-pr.yml index d4485fe..b2928f0 100644 --- a/.github/workflows/add-reviewer-pr.yml +++ b/.github/workflows/add-reviewer-pr.yml @@ -1,6 +1,6 @@ name: Add Reviewer PR on: - pull_request: + pull_request_target: types: [opened] jobs: run-action: @@ -13,4 +13,4 @@ jobs: - name: add_reviewer run: | - curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}' \ No newline at end of file + curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}' From 2a6cd14175b9e719697dd6893d3a6b934e7ca4fd Mon Sep 17 00:00:00 2001 From: Vipul Date: Tue, 29 Nov 2022 13:16:11 +0530 Subject: [PATCH 5/6] Add assignee to PR automatically --- .github/workflows/add-reviewer-pr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/add-reviewer-pr.yml b/.github/workflows/add-reviewer-pr.yml index b2928f0..cf65783 100644 --- a/.github/workflows/add-reviewer-pr.yml +++ b/.github/workflows/add-reviewer-pr.yml @@ -11,6 +11,10 @@ jobs: run: | echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT - - name: add_reviewer + - name: Request Review run: | curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}' + + - name: Add Assignee + run: | + curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}' From f8116c8945f09a2bcaa8992fb0f663a1a2a02c3f Mon Sep 17 00:00:00 2001 From: Vipul Date: Tue, 29 Nov 2022 13:19:00 +0530 Subject: [PATCH 6/6] Bug fix in PR assignee workflow --- .github/workflows/add-reviewer-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/add-reviewer-pr.yml b/.github/workflows/add-reviewer-pr.yml index cf65783..3346d9e 100644 --- a/.github/workflows/add-reviewer-pr.yml +++ b/.github/workflows/add-reviewer-pr.yml @@ -17,4 +17,4 @@ jobs: - name: Add Assignee run: | - curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}' + curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.pull_request.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'