From 3a6bdb6d81375bc1d3418cb5a49240c639c4d80a Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Sun, 10 Sep 2023 15:46:16 +0200 Subject: [PATCH] add new github action for netlify version --- .github/workflows/latest_dev_commit.yml | 29 +++++++++++++++++++++++++ src/App.js | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/latest_dev_commit.yml diff --git a/.github/workflows/latest_dev_commit.yml b/.github/workflows/latest_dev_commit.yml new file mode 100644 index 00000000..566ff2e5 --- /dev/null +++ b/.github/workflows/latest_dev_commit.yml @@ -0,0 +1,29 @@ +name: Latest Dev Commit + +on: + push: + branches: + - development + +jobs: + update-hash: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Get latest commit hash + id: vars + run: echo "::set-output name=commit_hash::$(git rev-parse HEAD)" + + - name: Update latest_dev_commit.txt + run: echo "${{ steps.vars.outputs.commit_hash }}" > ./public/latest_dev_commit.txt + + - name: Commit and push + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add ./public/latest_dev_commit.txt + git commit -m "Update latest_dev_commit.txt with latest commit hash" + git push diff --git a/src/App.js b/src/App.js index 1fb44a5b..a87a1681 100755 --- a/src/App.js +++ b/src/App.js @@ -79,7 +79,7 @@ export default function App() { // Check for commit hash if commitRef is defined if (commitRef.length > 0) { - const commitRes = await fetch('https://raw.githubusercontent.com/plebbit/plebchan/development/public/latest_commit.txt', { cache: 'no-cache' }); + const commitRes = await fetch('https://raw.githubusercontent.com/plebbit/plebchan/development/public/latest_dev_commit.txt', { cache: 'no-cache' }); const latestCommit = await commitRes.text(); if (latestCommit.trim() !== commitRef.trim()) {