mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
chore: Use argos tokenless auth
This commit is contained in:
5
.github/workflows/e2e.yml
vendored
5
.github/workflows/e2e.yml
vendored
@@ -129,14 +129,9 @@ jobs:
|
|||||||
# e.g. if this action was run from a fork
|
# e.g. if this action was run from a fork
|
||||||
record: ${{ env.RUN_VISUAL_TEST == 'true' && secrets.CYPRESS_RECORD_KEY != '' }}
|
record: ${{ env.RUN_VISUAL_TEST == 'true' && secrets.CYPRESS_RECORD_KEY != '' }}
|
||||||
env:
|
env:
|
||||||
# Only set Argos environment variables if the visual test comment trigger is present
|
|
||||||
ARGOS_TOKEN: ${{ env.RUN_VISUAL_TEST == 'true' && secrets.ARGOS_TOKEN || '' }}
|
|
||||||
ARGOS_PARALLEL: ${{ env.RUN_VISUAL_TEST == 'true' }}
|
ARGOS_PARALLEL: ${{ env.RUN_VISUAL_TEST == 'true' }}
|
||||||
ARGOS_PARALLEL_TOTAL: ${{ env.RUN_VISUAL_TEST == 'true' && strategy.job-total || 1 }}
|
ARGOS_PARALLEL_TOTAL: ${{ env.RUN_VISUAL_TEST == 'true' && strategy.job-total || 1 }}
|
||||||
ARGOS_PARALLEL_INDEX: ${{ env.RUN_VISUAL_TEST == 'true' && matrix.containers || 1 }}
|
ARGOS_PARALLEL_INDEX: ${{ env.RUN_VISUAL_TEST == 'true' && matrix.containers || 1 }}
|
||||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
||||||
GITHUB_JOB: ${{ github.job }}
|
|
||||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
|
||||||
CYPRESS_COMMIT: ${{ github.sha }}
|
CYPRESS_COMMIT: ${{ github.sha }}
|
||||||
CYPRESS_RECORD_KEY: ${{ env.RUN_VISUAL_TEST == 'true' && secrets.CYPRESS_RECORD_KEY || ''}}
|
CYPRESS_RECORD_KEY: ${{ env.RUN_VISUAL_TEST == 'true' && secrets.CYPRESS_RECORD_KEY || ''}}
|
||||||
SPLIT: ${{ strategy.job-total }}
|
SPLIT: ${{ strategy.job-total }}
|
||||||
|
@@ -5,14 +5,6 @@ import { defineConfig } from 'cypress';
|
|||||||
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
|
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
|
||||||
import cypressSplit from 'cypress-split';
|
import cypressSplit from 'cypress-split';
|
||||||
|
|
||||||
const encodeArgosToken = (options: {
|
|
||||||
owner: string;
|
|
||||||
repository: string;
|
|
||||||
jobId: string;
|
|
||||||
runId: string;
|
|
||||||
}) => `tokenless-github-${Buffer.from(JSON.stringify(options), 'utf8').toString('base64')}`;
|
|
||||||
// cspell:ignore tokenless
|
|
||||||
|
|
||||||
export default eyesPlugin(
|
export default eyesPlugin(
|
||||||
defineConfig({
|
defineConfig({
|
||||||
projectId: 'n2sma2',
|
projectId: 'n2sma2',
|
||||||
@@ -31,26 +23,10 @@ export default eyesPlugin(
|
|||||||
});
|
});
|
||||||
// copy any needed variables from process.env to config.env
|
// copy any needed variables from process.env to config.env
|
||||||
config.env.useAppli = process.env.USE_APPLI ? true : false;
|
config.env.useAppli = process.env.USE_APPLI ? true : false;
|
||||||
config.env.useArgos = !!process.env.CI && !!process.env.ARGOS_TOKEN;
|
config.env.useArgos = !!process.env.CI;
|
||||||
|
|
||||||
if (config.env.useArgos) {
|
if (config.env.useArgos) {
|
||||||
if (!process.env.GITHUB_REPOSITORY) {
|
registerArgosTask(on, config);
|
||||||
throw new Error('GITHUB_REPOSITORY is not set');
|
|
||||||
}
|
|
||||||
if (!process.env.GITHUB_JOB) {
|
|
||||||
throw new Error('GITHUB_JOB is not set');
|
|
||||||
}
|
|
||||||
if (!process.env.GITHUB_RUN_ID) {
|
|
||||||
throw new Error('GITHUB_RUN_ID is not set');
|
|
||||||
}
|
|
||||||
registerArgosTask(on, config, {
|
|
||||||
token: encodeArgosToken({
|
|
||||||
owner: process.env.GITHUB_REPOSITORY.split('/')[0],
|
|
||||||
repository: process.env.GITHUB_REPOSITORY.split('/')[1],
|
|
||||||
jobId: process.env.GITHUB_JOB,
|
|
||||||
runId: process.env.GITHUB_RUN_ID,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
addMatchImageSnapshotPlugin(on, config);
|
addMatchImageSnapshotPlugin(on, config);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user