From 5860ad3f1dc5b39f28dd3585b342f1684f3d8081 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 15 Feb 2021 10:41:08 +0100 Subject: [PATCH 1/3] do the sha generation on master --- .github/workflows/sha.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/sha.yml diff --git a/.github/workflows/sha.yml b/.github/workflows/sha.yml new file mode 100644 index 0000000..38210aa --- /dev/null +++ b/.github/workflows/sha.yml @@ -0,0 +1,34 @@ +name: SHA + +# Run this workflow ever time code is pushed to a branch +# other than `main` in your repository +on: push + +jobs: + # Set the job key. The key is displayed as the job name + # when a job name is not provided + sha: + # Name the Job + name: Commit SHA + # Set the type of machine to run on + runs-on: ubuntu-latest + + if: contains(github.ref, "master") + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + - name: Create SHA File + run: | + sha=$(git rev-parse --short "$GITHUB_SHA") + echo "#define GITHUB_SHA \"$sha\"" > GITHUB_SHA.h + + - uses: EndBug/add-and-commit@v4 # You can change this to use a specific version + with: + add: 'GITHUB_SHA.h' + message: 'Committing a SHA' + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged + \ No newline at end of file From 62d1f46a03e85c4c6d4bac04ccaac71da69824e1 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 15 Feb 2021 10:52:19 +0100 Subject: [PATCH 2/3] yaml syntax --- .github/workflows/sha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sha.yml b/.github/workflows/sha.yml index 38210aa..8aca1a5 100644 --- a/.github/workflows/sha.yml +++ b/.github/workflows/sha.yml @@ -13,7 +13,7 @@ jobs: # Set the type of machine to run on runs-on: ubuntu-latest - if: contains(github.ref, "master") + if: github.ref == 'refs/heads/master' steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code From 781d0325af43ead9646c17d4350380c34dbdfa85 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 15 Feb 2021 09:52:46 +0000 Subject: [PATCH 3/3] Committing a SHA --- GITHUB_SHA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index cca6c46..096d2bb 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "9db6d36" +#define GITHUB_SHA "62d1f46"