From 2c8c691f53d6376214fcfb8f2de6817d40b1b036 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Mon, 17 Jan 2022 22:33:49 -0500 Subject: [PATCH] fix(ci): markdown png not updated --- .github/scripts/files/examples.yml | 39 +++++-------------------- .github/workflows/ci.yml | 2 +- .github/workflows/examples.yml | 41 ++++++--------------------- source/plugins/starlists/README.md | 2 +- source/plugins/starlists/examples.yml | 2 +- source/plugins/starlists/index.mjs | 1 + tests/cases/starlists.plugin.yml | 2 +- 7 files changed, 20 insertions(+), 69 deletions(-) diff --git a/.github/scripts/files/examples.yml b/.github/scripts/files/examples.yml index 3a47d2a2..0d5cc62c 100644 --- a/.github/scripts/files/examples.yml +++ b/.github/scripts/files/examples.yml @@ -39,6 +39,11 @@ jobs: <%- steps.split("\n").map(line => ` ${line}`).join("\n") %> + - name: Screenshot markdown example + if: ${{ success() || failure() }} + run: | + node /metrics/.github/scripts/markdown_example.mjs + mv metrics.markdown.png / - name: Publish examples if: ${{ success() || failure() }} run: | @@ -46,42 +51,11 @@ jobs: sudo mv /metrics_renders/* ./ git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git pull git add --all git commit -m "chore: update examples" git push -# ====================================================================================== -# Markdown as png (for readme updates) -# ====================================================================================== - - examples-markdown: - runs-on: ubuntu-latest - if: "github.repository == 'lowlighter/metrics'" - container: ghcr.io/lowlighter/metrics:master - needs: [examples] - steps: - - name: Screenshot markdown example - run: | - node /metrics/.github/scripts/markdown_example.mjs - echo "METRICS_MARKDOWN_EXAMPLE=$(base64 --wrap=0 metrics.markdown.png)" >> $GITHUB_ENV - - name: Update markdown example - uses: actions/github-script@v5 - env: - METRICS_MARKDOWN_EXAMPLE: "${{ env.METRICS_MARKDOWN_EXAMPLE }}" - with: - script: | - try { - const {data:{sha}} = await github.rest.repos.getContent({...context.repo, path:"metrics.markdown.png"}) - console.log(`current sha: ${sha}`) - github.rest.repos.createOrUpdateFileContents({ - ...context.repo, - path:"metrics.markdown.png", - message:`Auto-generated metrics for run #${github.context ? github.context.runId : "0000000000"}`, - content:process.env.METRICS_MARKDOWN_EXAMPLE, - sha, - }) - } catch (error) { console.log(error) } - # ====================================================================================== # Special job used to render lowlighter/metrics repository assets # ====================================================================================== @@ -153,6 +127,7 @@ jobs: sudo mv /metrics_renders/* ./ git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git pull git add --all git commit -m "chore: update examples" git push diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4be1cceb..68869eaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,7 +154,7 @@ jobs: docker-release: name: Publish release to GitHub registry runs-on: ubuntu-latest - needs: [ action-master-test ] + needs: [ action-master-test, publish-examples ] if: contains(github.event.head_commit.message, '[release]') steps: - name: Checkout repository diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 1395f411..c48652cf 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -664,7 +664,7 @@ jobs: base: "" plugin_starlists: yes plugin_starlists_limit_repositories: 2 - plugin_starlists_only: 🤘 TC39 + plugin_starlists_only: TC39 output_action: none delay: 120 user: lowlighter @@ -1132,6 +1132,11 @@ jobs: if: ${{ success() || failure() }} + - name: Screenshot markdown example + if: ${{ success() || failure() }} + run: | + node /metrics/.github/scripts/markdown_example.mjs + mv metrics.markdown.png / - name: Publish examples if: ${{ success() || failure() }} run: | @@ -1139,42 +1144,11 @@ jobs: sudo mv /metrics_renders/* ./ git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git pull git add --all git commit -m "chore: update examples" git push -# ====================================================================================== -# Markdown as png (for readme updates) -# ====================================================================================== - - examples-markdown: - runs-on: ubuntu-latest - if: "github.repository == 'lowlighter/metrics'" - container: ghcr.io/lowlighter/metrics:master - needs: [examples] - steps: - - name: Screenshot markdown example - run: | - node /metrics/.github/scripts/markdown_example.mjs - echo "METRICS_MARKDOWN_EXAMPLE=$(base64 --wrap=0 metrics.markdown.png)" >> $GITHUB_ENV - - name: Update markdown example - uses: actions/github-script@v5 - env: - METRICS_MARKDOWN_EXAMPLE: "${{ env.METRICS_MARKDOWN_EXAMPLE }}" - with: - script: | - try { - const {data:{sha}} = await github.rest.repos.getContent({...context.repo, path:"metrics.markdown.png"}) - console.log(`current sha: ${sha}`) - github.rest.repos.createOrUpdateFileContents({ - ...context.repo, - path:"metrics.markdown.png", - message:`Auto-generated metrics for run #${github.context ? github.context.runId : "0000000000"}`, - content:process.env.METRICS_MARKDOWN_EXAMPLE, - sha, - }) - } catch (error) { console.log(error) } - # ====================================================================================== # Special job used to render lowlighter/metrics repository assets # ====================================================================================== @@ -1246,6 +1220,7 @@ jobs: sudo mv /metrics_renders/* ./ git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git pull git add --all git commit -m "chore: update examples" git push diff --git a/source/plugins/starlists/README.md b/source/plugins/starlists/README.md index 78cfa243..5c5aad70 100644 --- a/source/plugins/starlists/README.md +++ b/source/plugins/starlists/README.md @@ -117,7 +117,7 @@ with: base: "" plugin_starlists: yes plugin_starlists_limit_repositories: 2 - plugin_starlists_only: 🤘 TC39 + plugin_starlists_only: TC39 ``` diff --git a/source/plugins/starlists/examples.yml b/source/plugins/starlists/examples.yml index 2de9f6f6..088d2c8a 100644 --- a/source/plugins/starlists/examples.yml +++ b/source/plugins/starlists/examples.yml @@ -6,6 +6,6 @@ base: "" plugin_starlists: yes plugin_starlists_limit_repositories: 2 - plugin_starlists_only: 🤘 TC39 + plugin_starlists_only: TC39 test: timeout: 1800000 diff --git a/source/plugins/starlists/index.mjs b/source/plugins/starlists/index.mjs index d4a34c43..26362277 100644 --- a/source/plugins/starlists/index.mjs +++ b/source/plugins/starlists/index.mjs @@ -30,6 +30,7 @@ export default async function({login, q, imports, data, account}, {enabled = fal )) const count = lists.length console.debug(`metrics/compute/${login}/plugins > starlists > found [${lists.map(({name}) => name)}]`) + console.log(">>>>> DEBUG", lists.map(({name}) => name), lists.map(({name}) => imports.stripemojis(name ?? "").trim().toLocaleLowerCase()), only, ignored) lists = lists .filter(({name}) => { name = imports.stripemojis(name ?? "").trim().toLocaleLowerCase() diff --git a/tests/cases/starlists.plugin.yml b/tests/cases/starlists.plugin.yml index 895f55cc..1476a38f 100644 --- a/tests/cases/starlists.plugin.yml +++ b/tests/cases/starlists.plugin.yml @@ -4,7 +4,7 @@ token: MOCKED_TOKEN plugin_starlists: 'yes' plugin_starlists_limit_repositories: 2 - plugin_starlists_only: 🤘 TC39 + plugin_starlists_only: TC39 use_mocked_data: 'yes' verify: 'yes' timeout: 1800000