Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/audit-docs-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,28 @@ jobs:

const versions = await ElectronVersions.create({ ignoreCache: true });

const { data } = await github.rest.repos.listCommits({
const { data: { published_at: publishedAt } } = await github.rest.repos.getReleaseByTag({
owner: 'electron',
repo: 'electron',
sha: `${versions.latestStable.major}-x-y`,
path: 'docs/',
per_page: 1
tag: `v${versions.latestStable.version}`,
});
const commit = data[0];

const { date } = commit.commit.committer;
const delta = Date.now() - new Date(date).getTime();
const { data: commit } = await github.rest.repos.getCommit({
owner: 'electron',
repo: 'electron',
ref: `refs/tags/v${versions.latestStable.version}`,
});

const delta = Date.now() - new Date(publishedAt).getTime();

// If the commit happened recently, wait a bit for the site
// If the release was published recently, wait a bit for the site
// to deploy before checking so we don't get a false positive
if (delta < DELTA_THRESHOLD_MS) {
await setTimeout(DELTA_THRESHOLD_MS - delta);
}

if (commit.sha !== latestDocsSHA) {
// A bug in `electron-website-updater` sometimes sends up new commits that
// touched any file with `docs` in the name, so allow commits to be newer
// Allow commits to be newer in case we want to deploy a docs hotfix
const comparison = await github.rest.repos.compareCommitsWithBasehead({
owner: 'electron',
repo: 'electron',
Expand Down