Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: temporary workflow to resolve Electron release versions for PRs #586

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

dsanders11
Copy link
Member

@dsanders11 dsanders11 commented Jun 26, 2024

This is a temporary workflow in support of @piotrpdev's Google Summer of Code work. Long-term this will be removed from this repo and the code will be refactored to live on electron/release-status, but for now this is the easiest place to put it such that it can be used immediately. Since it is temporary I've kept it isolated entirely to this one file so it doesn't affect anything else in this repo.

Example snippet of how to fetch the content from the latest workflow run is included below. Requires a GitHub token with actions: read perms on electron/website repo.

const AdmZip = require('adm-zip');

const AUTH_HEADER = { Authorization: `Bearer ${ process.env.GH_TOKEN }` };

let resp = await fetch('https://api.github.com/repos/electron/website/actions/artifacts', { headers: AUTH_HEADER });
const latestArtifact = (await resp.json()).artifacts.filter(({ name }) => name === 'resolved-pr-versions').sort((a, b) => a.id > b.id)[0];

resp = await fetch(latestArtifact.archive_download_url, { headers: AUTH_HEADER });
const buffer = Buffer.from(await resp.arrayBuffer());

const zip = new AdmZip(buffer);
const data = JSON.parse(zip.readAsText(zip.getEntries()[0]));

@dsanders11 dsanders11 requested a review from a team as a code owner June 26, 2024 02:34
@MarshallOfSound MarshallOfSound temporarily deployed to electronjsorg-new-pr-586 June 26, 2024 02:35 Inactive
@dsanders11 dsanders11 force-pushed the ci/resolve-pr-versions-workflow branch from 113e6d6 to a6572e1 Compare June 26, 2024 02:37
@MarshallOfSound MarshallOfSound temporarily deployed to electronjsorg-new-pr-586 June 26, 2024 02:38 Inactive
@MarshallOfSound MarshallOfSound temporarily deployed to electronjsorg-new-pr-586 June 26, 2024 17:44 Inactive
Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One nit question

const getBackportPattern = () =>
/(?:^|\n)(?:manual |manually )?backport (?:of )?(?:#(\d+)|https:\/\/github.com\/.*\/pull\/(\d+))/gim;

const BOOTSTRAP_DATA_URL = 'https://gist.githubusercontent.com/dsanders11/eb51a04d04a6a3e0710d88db5250e698/raw/fd960b6dea1152b55427407646044f1ba187e52b/data.json';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am incredibly nitting here, but do we want to pop this into an Electron repo somewhere? If we think this will actually be pretty temporary, I'm okay leaving it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a valid point to raise! I'm definitely intending for this workflow overall to be pretty temporary (pending practical realities getting int he way), but this line in particular can be super temporary. Once we merge and have one run of the workflow to store an artifact, this line can be removed entirely as the bootstrap step will be complete and shouldn't (unless artifacts somehow all got jettisoned) be needed again.

@dsanders11 dsanders11 merged commit 3d330cb into main Jun 26, 2024
3 checks passed
@dsanders11 dsanders11 deleted the ci/resolve-pr-versions-workflow branch June 26, 2024 23:56
This was referenced Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants