From 6d599ff712e773f52b4d2ef0bf6b8b8b338e5c0e Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 3 Aug 2023 21:24:22 -0400 Subject: [PATCH 1/5] Fix gh action --- .github/workflows/test_action.yaml | 2 -- action.yaml | 1 - 2 files changed, 3 deletions(-) diff --git a/.github/workflows/test_action.yaml b/.github/workflows/test_action.yaml index cfbe81f..f95f772 100644 --- a/.github/workflows/test_action.yaml +++ b/.github/workflows/test_action.yaml @@ -2,8 +2,6 @@ name: Test Action on: pull_request: branches: ["main"] - push: - branches: ["main"] jobs: check-pr-is-updated: diff --git a/action.yaml b/action.yaml index a60a1d7..25db858 100644 --- a/action.yaml +++ b/action.yaml @@ -6,7 +6,6 @@ inputs: remote_branch: description: 'Remote branch (e.g.: upstream/main)' required: true - default: 'upstream/main' pr_sha: description: 'PR SHA' required: true From b9884bf29e07ca66d52cd507980261183fbdd7b7 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 3 Aug 2023 21:37:28 -0400 Subject: [PATCH 2/5] use composite instead of docker --- Dockerfile | 14 -------------- action.yaml | 13 ++++++++----- entrypoint.sh | 9 --------- 3 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 Dockerfile delete mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index b5a0261..0000000 --- a/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -# Container image that runs your code -FROM python:3.8-slim - -RUN apt update \ - && apt install -y --no-install-recommends git \ - && rm -rf /var/lib/apt/lists/* \ - /var/cache/apt/archives \ - /tmp/* - -# Copies your code file from your action repository to the filesystem path `/` of the container -COPY entrypoint.sh /entrypoint.sh - -# Code file to execute when the docker container starts up (`entrypoint.sh`) -ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yaml b/action.yaml index 25db858..14aa754 100644 --- a/action.yaml +++ b/action.yaml @@ -15,8 +15,11 @@ branding: color: green runs: - using: 'docker' - image: 'Dockerfile' - args: - - ${{ inputs.remote_branch }} - - ${{ inputs.pr_sha }} + using: 'composite' + steps: + name: check if the PR branch is updated + run: | + if ! git merge-base --is-ancestor ${{ inputs.remote_branch }} ${{ inputs.pr_sha }}; then + echo "This branch is not up to date with ${{ inputs.remote_branch }}"; + exit 1; + fi diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100755 index 45f05a3..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -export REMOTE_BRANCH="$1" -export PR_SHA="$2" - -if ! git merge-base --is-ancestor ${REMOTE_BRANCH} ${PR_SHA}; then - echo "This branch is not up to date with ${REMOTE_BRANCH}"; - exit 1; -fi From ff50829ee10f5985d5502196e14e3a039fe67872 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 3 Aug 2023 21:39:32 -0400 Subject: [PATCH 3/5] fix action.ayml --- action.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/action.yaml b/action.yaml index 14aa754..1962261 100644 --- a/action.yaml +++ b/action.yaml @@ -17,9 +17,9 @@ branding: runs: using: 'composite' steps: - name: check if the PR branch is updated - run: | - if ! git merge-base --is-ancestor ${{ inputs.remote_branch }} ${{ inputs.pr_sha }}; then - echo "This branch is not up to date with ${{ inputs.remote_branch }}"; - exit 1; - fi + - name: check if the PR branch is updated + run: | + if ! git merge-base --is-ancestor ${{ inputs.remote_branch }} ${{ inputs.pr_sha }}; then + echo "This branch is not up to date with ${{ inputs.remote_branch }}"; + exit 1; + fi From 88be43c73d3d030cedd411824202a7bdca3bc82b Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 3 Aug 2023 21:41:03 -0400 Subject: [PATCH 4/5] add shell --- action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yaml b/action.yaml index 1962261..5e7663a 100644 --- a/action.yaml +++ b/action.yaml @@ -18,6 +18,7 @@ runs: using: 'composite' steps: - name: check if the PR branch is updated + shell: bash run: | if ! git merge-base --is-ancestor ${{ inputs.remote_branch }} ${{ inputs.pr_sha }}; then echo "This branch is not up to date with ${{ inputs.remote_branch }}"; From 9d2ac3a86174f69f9cf6c783c811f4fe18af6906 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 3 Aug 2023 21:44:59 -0400 Subject: [PATCH 5/5] add fetch-depth --- .github/workflows/test_action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_action.yaml b/.github/workflows/test_action.yaml index f95f772..654af12 100644 --- a/.github/workflows/test_action.yaml +++ b/.github/workflows/test_action.yaml @@ -11,6 +11,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: 'check if the PR branch is updated or not' id: check_pr_is_updated