mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
delete workflow, use github api to fetch latest dev commit
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
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
|
||||
+6
-4
@@ -82,11 +82,13 @@ 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_dev_commit.txt', { cache: 'no-cache' });
|
||||
const latestCommit = await commitRes.text();
|
||||
const commitRes = await fetch('https://api.github.com/repos/plebbit/plebchan/commits?per_page=1&sha=development', { cache: 'no-cache' });
|
||||
const commitData = await commitRes.json();
|
||||
|
||||
if (latestCommit.trim() !== commitRef.trim()) {
|
||||
const newVersionInfo = `New dev version available, commit ${latestCommit}. Refresh the page to update.`;
|
||||
const latestCommitHash = commitData[0].sha;
|
||||
|
||||
if (latestCommitHash.trim() !== commitRef.trim()) {
|
||||
const newVersionInfo = `New dev version available, commit ${latestCommitHash}. Refresh the page to update.`;
|
||||
localStorage.setItem('infoToast', newVersionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user