2021-02-15 10:41:08 +01:00
|
|
|
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
|
|
|
|
|
2021-02-15 10:52:19 +01:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-02-15 10:41:08 +01:00
|
|
|
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
|
|
|
|
|
2022-02-16 18:02:11 +01:00
|
|
|
- uses: EndBug/add-and-commit@v8 # You can change this to use a specific version
|
2021-02-15 10:41:08 +01:00
|
|
|
with:
|
|
|
|
add: 'GITHUB_SHA.h'
|
|
|
|
message: 'Committing a SHA'
|
2022-02-16 18:02:11 +01:00
|
|
|
commit: --amend
|
2021-02-15 10:41:08 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
|
|
|
|
|