From 1d651a66de7ccab74d0935602a5cf8fcc5450819 Mon Sep 17 00:00:00 2001 From: Anders Qvist Date: Mon, 25 Oct 2021 09:57:07 +0200 Subject: [PATCH] GitHub Action support for status action. --- README.md | 22 ++++++++++++++++++++++ action-entrypoint.sh | 6 ++++++ action.yaml | 4 +++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4dc0585..a992d14 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,28 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} ``` +In order to block automatic promotion, you can add a status workflow: + +```yaml +on: + pull_request: + branches: + - main +jobs: + prev-env-status: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + # gitops-promotion currently needs access to history + fetch-depth: 0 + - uses: xenitab/gitops-promotion@v0.0.8 + with: + action: status + token: ${{ secrets.GITHUB_TOKEN }} +``` + ## Building You will need pkg-config and libgit2, please install it from your package manager. diff --git a/action-entrypoint.sh b/action-entrypoint.sh index 4c37e82..abf8e53 100755 --- a/action-entrypoint.sh +++ b/action-entrypoint.sh @@ -18,6 +18,12 @@ case $ACTION in -sourcedir "$GITHUB_WORKSPACE" \ -token "$TOKEN" ;; + status) + /usr/local/bin/gitops-promotion status \ + -provider github \ + -sourcedir "$GITHUB_WORKSPACE" \ + -token "$TOKEN" + ;; *) echo "Unkown action $ACTION" exit 1 diff --git a/action.yaml b/action.yaml index ba3b88c..709c595 100644 --- a/action.yaml +++ b/action.yaml @@ -4,7 +4,9 @@ description: | A tool to do automatic promotion with a GitOps workflow. inputs: action: - description: Action to perform; one of "new" or "promote". + description: > + Action to perform; one of "new", "promote" or "status". See + https://github.com/XenitAB/gitops-promotion/README.md for details. required: true token: description: Access token (PAT) to git provider. You probably want secrets.GITHUB_TOKEN