From 473e33589d8060963f0db1bcd822ef05a51042fd Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:15:30 +1000 Subject: [PATCH 01/13] gpavelar/c05-actions01 --- .../gpavelar-gh-actions-workflow.yaml | 23 +++++++++++++ gpavelar/README.md | 32 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/gpavelar-gh-actions-workflow.yaml create mode 100644 gpavelar/README.md diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml new file mode 100644 index 0000000..9753607 --- /dev/null +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -0,0 +1,23 @@ +name: GPAVELAR/C05-ACTIONS01 +on: + pull_request: + branches: + - master + paths: 'gpavelar/**' + +jobs: + comment: + name: Deploy + runs-on: ubuntu-latest + env: + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} + GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} + + steps: + - name: Comment on PR + uses: mshick/add-pr-comment@v1 + with: + message: "Well done $MY_NAME ! This is a nice PR" + repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token-user-login: 'github-actions[bot]' + allow-repeats: false \ No newline at end of file diff --git a/gpavelar/README.md b/gpavelar/README.md new file mode 100644 index 0000000..aa3dfb7 --- /dev/null +++ b/gpavelar/README.md @@ -0,0 +1,32 @@ +# C05-ACTIONS01 + +## Commands + +```yml +# This workflow will deploy a new task definition to Amazon ECS based on the image pushed to ECR, when a merge is created + +name: GPAVELAR/C05-ACTIONS01 +on: + pull_request: + branches: + - master + paths: 'gpavelar/**' + +jobs: + comment: + name: Deploy + runs-on: ubuntu-latest + env: + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} + GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} + + steps: + - name: Comment on PR + uses: mshick/add-pr-comment@v1 + with: + message: "Well done $MY_NAME ! This is a nice PR" + repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token-user-login: 'github-actions[bot]' + allow-repeats: false + +``` \ No newline at end of file From 044a14ca8ab2a31610afc994c15b15b0367975d4 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:22:16 +1000 Subject: [PATCH 02/13] Attempt 1 - Fix PR message --- gpavelar/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gpavelar/README.md b/gpavelar/README.md index aa3dfb7..c80fcba 100644 --- a/gpavelar/README.md +++ b/gpavelar/README.md @@ -16,16 +16,16 @@ jobs: comment: name: Deploy runs-on: ubuntu-latest - env: - MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} - GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} - + steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 + env: + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} + GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: message: "Well done $MY_NAME ! This is a nice PR" - repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token: $GITHUB_TOKEN repo-token-user-login: 'github-actions[bot]' allow-repeats: false From f07f6e0b9c370dbdb71f30b20e3c3a391b4e7d9a Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:26:35 +1000 Subject: [PATCH 03/13] Attempt 2 - Fix workflow --- gpavelar/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpavelar/README.md b/gpavelar/README.md index c80fcba..cd37a67 100644 --- a/gpavelar/README.md +++ b/gpavelar/README.md @@ -24,8 +24,8 @@ jobs: MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: - message: "Well done $MY_NAME ! This is a nice PR" - repo-token: $GITHUB_TOKEN + message: "Well done ${{ MY_NAME }} ! This is a nice PR" + repo-token: ${{ GITHUB_TOKEN }} repo-token-user-login: 'github-actions[bot]' allow-repeats: false From 20533591796c789ff893bd206c09528a5c211006 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:28:29 +1000 Subject: [PATCH 04/13] allow repeat message --- gpavelar/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpavelar/README.md b/gpavelar/README.md index cd37a67..f8b96f0 100644 --- a/gpavelar/README.md +++ b/gpavelar/README.md @@ -27,6 +27,6 @@ jobs: message: "Well done ${{ MY_NAME }} ! This is a nice PR" repo-token: ${{ GITHUB_TOKEN }} repo-token-user-login: 'github-actions[bot]' - allow-repeats: false + allow-repeats: true ``` \ No newline at end of file From 8a52b334e55a7127645e24456af2981724e011a2 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:31:04 +1000 Subject: [PATCH 05/13] Allow repeated message --- .../workflows/gpavelar-gh-actions-workflow.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml index 9753607..987cf3a 100644 --- a/.github/workflows/gpavelar-gh-actions-workflow.yaml +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -9,15 +9,15 @@ jobs: comment: name: Deploy runs-on: ubuntu-latest - env: - MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} - GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} - + steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 + env: + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} + GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: - message: "Well done $MY_NAME ! This is a nice PR" - repo-token: ${{ secrets.GITHUB_TOKEN }} + message: "Well done ${{ MY_NAME }} ! This is a nice PR" + repo-token: ${{ GITHUB_TOKEN }} repo-token-user-login: 'github-actions[bot]' - allow-repeats: false \ No newline at end of file + allow-repeats: true \ No newline at end of file From 8d3a1e2f14591b05f7ad89879b6baeed9f8d9a53 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:33:42 +1000 Subject: [PATCH 06/13] remove env variables --- gpavelar/README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gpavelar/README.md b/gpavelar/README.md index f8b96f0..d896600 100644 --- a/gpavelar/README.md +++ b/gpavelar/README.md @@ -20,12 +20,9 @@ jobs: steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 - env: - MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} - GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: - message: "Well done ${{ MY_NAME }} ! This is a nice PR" - repo-token: ${{ GITHUB_TOKEN }} + message: "Well done ${{ secrets.GPAVELAR_USERNAME }} ! This is a nice PR" + repo-token: ${{ secrets.GPAVELAR_PAT }} repo-token-user-login: 'github-actions[bot]' allow-repeats: true From 195b11eb2cdb4002dd7b7b2440ac03744f14d97e Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:34:15 +1000 Subject: [PATCH 07/13] Remove ENV variable from yaml --- .github/workflows/gpavelar-gh-actions-workflow.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml index 987cf3a..e6b269a 100644 --- a/.github/workflows/gpavelar-gh-actions-workflow.yaml +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -13,11 +13,8 @@ jobs: steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 - env: - MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} - GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: - message: "Well done ${{ MY_NAME }} ! This is a nice PR" - repo-token: ${{ GITHUB_TOKEN }} + message: "Well done ${{ secrets.GPAVELAR_USERNAME }} ! This is a nice PR" + repo-token: ${{ secrets.GPAVELAR_PAT }} repo-token-user-login: 'github-actions[bot]' allow-repeats: true \ No newline at end of file From 6e7bd9c403cabd76761f3df6d08ca6005f90860a Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:54:47 +1000 Subject: [PATCH 08/13] Test environment variables on GH Actions --- .github/workflows/gpavelar-gh-actions-workflow.yaml | 9 ++++++--- gpavelar/README.md | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml index e6b269a..3d7d02b 100644 --- a/.github/workflows/gpavelar-gh-actions-workflow.yaml +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -9,12 +9,15 @@ jobs: comment: name: Deploy runs-on: ubuntu-latest - + env: + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} + GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} + steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 with: - message: "Well done ${{ secrets.GPAVELAR_USERNAME }} ! This is a nice PR" - repo-token: ${{ secrets.GPAVELAR_PAT }} + message: "Well done $MY_NAME! This is a nice PR (using env variables)" + repo-token: $GITHUB_TOKEN repo-token-user-login: 'github-actions[bot]' allow-repeats: true \ No newline at end of file diff --git a/gpavelar/README.md b/gpavelar/README.md index d896600..a9502ba 100644 --- a/gpavelar/README.md +++ b/gpavelar/README.md @@ -21,7 +21,7 @@ jobs: - name: Comment on PR uses: mshick/add-pr-comment@v1 with: - message: "Well done ${{ secrets.GPAVELAR_USERNAME }} ! This is a nice PR" + message: "Well done ${{ secrets.GPAVELAR_USERNAME }} ! This is a nice PR " repo-token: ${{ secrets.GPAVELAR_PAT }} repo-token-user-login: 'github-actions[bot]' allow-repeats: true From bce9b3be5d959e08699dba4501a28d9e5e24dfc7 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:57:00 +1000 Subject: [PATCH 09/13] environment variables on steps --- .github/workflows/gpavelar-gh-actions-workflow.yaml | 8 ++++---- gpavelar/README.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml index 3d7d02b..8880500 100644 --- a/.github/workflows/gpavelar-gh-actions-workflow.yaml +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -9,13 +9,13 @@ jobs: comment: name: Deploy runs-on: ubuntu-latest - env: - MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} - GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} - + steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 + env: + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} + GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: message: "Well done $MY_NAME! This is a nice PR (using env variables)" repo-token: $GITHUB_TOKEN diff --git a/gpavelar/README.md b/gpavelar/README.md index a9502ba..d896600 100644 --- a/gpavelar/README.md +++ b/gpavelar/README.md @@ -21,7 +21,7 @@ jobs: - name: Comment on PR uses: mshick/add-pr-comment@v1 with: - message: "Well done ${{ secrets.GPAVELAR_USERNAME }} ! This is a nice PR " + message: "Well done ${{ secrets.GPAVELAR_USERNAME }} ! This is a nice PR" repo-token: ${{ secrets.GPAVELAR_PAT }} repo-token-user-login: 'github-actions[bot]' allow-repeats: true From b53d71dacae2889b08e8c7102567496553b43536 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 15:58:30 +1000 Subject: [PATCH 10/13] remove repo-token. Using env variables --- .github/workflows/gpavelar-gh-actions-workflow.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml index 8880500..133b9aa 100644 --- a/.github/workflows/gpavelar-gh-actions-workflow.yaml +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -9,7 +9,7 @@ jobs: comment: name: Deploy runs-on: ubuntu-latest - + steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 @@ -18,6 +18,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: message: "Well done $MY_NAME! This is a nice PR (using env variables)" - repo-token: $GITHUB_TOKEN repo-token-user-login: 'github-actions[bot]' allow-repeats: true \ No newline at end of file From 58953d85e2b306cf2decd5ca78fef7110da07f85 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 16:01:21 +1000 Subject: [PATCH 11/13] Change MY_NAME variable location --- .github/workflows/gpavelar-gh-actions-workflow.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml index 133b9aa..7443066 100644 --- a/.github/workflows/gpavelar-gh-actions-workflow.yaml +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -9,12 +9,13 @@ jobs: comment: name: Deploy runs-on: ubuntu-latest + env: + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 env: - MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: message: "Well done $MY_NAME! This is a nice PR (using env variables)" From e60cdc8d94144dd7e27e6f48d5f87b8f32f6ef59 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 16:06:55 +1000 Subject: [PATCH 12/13] set env MY_NAME --- .github/workflows/gpavelar-gh-actions-workflow.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml index 7443066..e689d2f 100644 --- a/.github/workflows/gpavelar-gh-actions-workflow.yaml +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -10,7 +10,7 @@ jobs: name: Deploy runs-on: ubuntu-latest env: - MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} steps: - name: Comment on PR @@ -18,6 +18,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: - message: "Well done $MY_NAME! This is a nice PR (using env variables)" + message: "Well done ${{ env.MY_NAME }}! This is a nice PR" repo-token-user-login: 'github-actions[bot]' allow-repeats: true \ No newline at end of file From fe02d1318c0a465aa76899e002ca40098bd715f5 Mon Sep 17 00:00:00 2001 From: Gustavo Avelar Date: Mon, 31 Aug 2020 16:10:05 +1000 Subject: [PATCH 13/13] Disable repeated messages --- .github/workflows/gpavelar-gh-actions-workflow.yaml | 2 +- gpavelar/README.md | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gpavelar-gh-actions-workflow.yaml b/.github/workflows/gpavelar-gh-actions-workflow.yaml index e689d2f..8e51db6 100644 --- a/.github/workflows/gpavelar-gh-actions-workflow.yaml +++ b/.github/workflows/gpavelar-gh-actions-workflow.yaml @@ -20,4 +20,4 @@ jobs: with: message: "Well done ${{ env.MY_NAME }}! This is a nice PR" repo-token-user-login: 'github-actions[bot]' - allow-repeats: true \ No newline at end of file + allow-repeats: false \ No newline at end of file diff --git a/gpavelar/README.md b/gpavelar/README.md index d896600..d2a83e2 100644 --- a/gpavelar/README.md +++ b/gpavelar/README.md @@ -3,7 +3,7 @@ ## Commands ```yml -# This workflow will deploy a new task definition to Amazon ECS based on the image pushed to ECR, when a merge is created +# This workflow send a message to PR to change a file under my directory name: GPAVELAR/C05-ACTIONS01 on: @@ -16,14 +16,17 @@ jobs: comment: name: Deploy runs-on: ubuntu-latest - + env: + MY_NAME: ${{ secrets.GPAVELAR_USERNAME }} + steps: - name: Comment on PR uses: mshick/add-pr-comment@v1 + env: + GITHUB_TOKEN: ${{ secrets.GPAVELAR_PAT }} with: - message: "Well done ${{ secrets.GPAVELAR_USERNAME }} ! This is a nice PR" - repo-token: ${{ secrets.GPAVELAR_PAT }} + message: "Well done ${{ env.MY_NAME }} ! This is a nice PR" repo-token-user-login: 'github-actions[bot]' - allow-repeats: true + allow-repeats: false ``` \ No newline at end of file