From 4466aee4b0ae290e7e799246ec33b759771bb123 Mon Sep 17 00:00:00 2001 From: Gaku Yasui Date: Wed, 27 Apr 2022 15:48:27 +0900 Subject: [PATCH 1/4] Support push event --- Dockerfile | 2 +- action.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a09d8ed..f53335c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1 @@ -FROM gcr.io/pipecd/actions-plan-preview:1.7.2 +FROM gcr.io/pipecd/actions-plan-preview:1.8.0 diff --git a/action.yaml b/action.yaml index ad62045..8117dc0 100644 --- a/action.yaml +++ b/action.yaml @@ -16,6 +16,9 @@ inputs: description: 'Maximum amount of time to run. Default is 5m.' required: false default: 5m + pull-request-number: + description: 'PR Number needed for push event' + required: false runs: using: 'docker' @@ -25,6 +28,7 @@ runs: - api-key=${{ inputs.api-key }} - token=${{ inputs.token }} - timeout=${{ inputs.timeout }} + - pull-request-number=${{ inputs.pull-request-number }} branding: icon: 'eye' From a018d995db606fc323c79729feb0684b0f7ab328 Mon Sep 17 00:00:00 2001 From: Gaku Yasui Date: Thu, 28 Apr 2022 08:26:29 +0900 Subject: [PATCH 2/4] Update README.md --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 1dde30c..62dfa80 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,36 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} ``` +### Push events + +To run actions-plan-preview after automatically creating PRs on push events using [GITHUB_TOKEN](https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow), it goes as follows. + +```yaml +name: PipeCD + +on: + push: + branches: pr-target-branch +jobs: + create-pr: + runs-on: ubuntu-latest + if: "github.event.created" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + - id: create-pr + run: | + PR=$(gh pr create --title "Update" --body "" | awk -F "/" '{print $NF}') + echo "::set-output name=pull-request-number::$PR" + - uses: pipe-cd/actions-plan-preview@v1.8.0 + with: + address: ${{ secrets.PIPECD_API_ADDRESS }} + api-key: ${{ secrets.PIPECD_PLAN_PREVIEW_API_KEY }} + token: ${{ secrets.GITHUB_TOKEN }} + pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }} +``` + ## Inputs | Name | Description | Required | Default Value | @@ -66,3 +96,4 @@ jobs: | address | The API address of PipeCD's control-plane. | yes | | | api-key | The API key with READ_WRITE role used by pipectl while communicating with PipeCD's control-plane. | yes | | | token | The GITHUB_TOKEN secret. | yes | | +| pull-request-number | PR Number needed for push event. | false | | From 9aaf3f9f1c4088e37b4dd0fe08d26bc2a6feff6b Mon Sep 17 00:00:00 2001 From: Gaku Yasui Date: Thu, 28 Apr 2022 08:41:13 +0900 Subject: [PATCH 3/4] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 62dfa80..e941725 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ jobs: runs-on: ubuntu-latest if: "github.event_name == 'pull_request'" steps: - - uses: pipe-cd/actions-plan-preview@v1.7.2 + - uses: pipe-cd/actions-plan-preview@v1.8.0 with: address: ${{ secrets.PIPECD_API_ADDRESS }} api-key: ${{ secrets.PIPECD_PLAN_PREVIEW_API_KEY }} @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-latest if: "github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/pipecd plan-preview')" steps: - - uses: pipe-cd/actions-plan-preview@v1.7.2 + - uses: pipe-cd/actions-plan-preview@v1.8.0 with: address: ${{ secrets.PIPECD_API_ADDRESS }} api-key: ${{ secrets.PIPECD_PLAN_PREVIEW_API_KEY }} From a76335ac15633b63343d2ebdc5d95dbf38149b1d Mon Sep 17 00:00:00 2001 From: Gaku Yasui Date: Thu, 12 May 2022 10:23:35 +0900 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e941725..fa6ddf6 100644 --- a/README.md +++ b/README.md @@ -96,4 +96,4 @@ jobs: | address | The API address of PipeCD's control-plane. | yes | | | api-key | The API key with READ_WRITE role used by pipectl while communicating with PipeCD's control-plane. | yes | | | token | The GITHUB_TOKEN secret. | yes | | -| pull-request-number | PR Number needed for push event. | false | | +| pull-request-number | PR Number needed for push event. | no | |