From 5f8d1d2fb3cc955ccbb92809eaa562d35534fb97 Mon Sep 17 00:00:00 2001 From: mike dupont Date: Wed, 10 Apr 2024 07:37:10 -0400 Subject: [PATCH 1/3] closure of the gh actions to my org --- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/actions/install-dependencies/action.yml | 2 +- .github/workflows/check-dist.yml | 4 ++-- .github/workflows/ci.yml | 2 +- .github/workflows/codeql-analysis.yml | 8 ++++---- .github/workflows/integration.yml | 16 ++++++++-------- .github/workflows/licensed.yml | 6 +++--- .github/workflows/pull-request-test.yml | 6 +++--- .github/workflows/stale.yml | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 279f9eaaf..59198cf14 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: true contact_links: - name: Ask a question or provide feedback about using this action about: For general Q&A and feedback, see the Discussions tab. - url: https://github.com/actions/github-script/discussions + url: https://github.com/meta-introspector/github-script/discussions - name: Ask a question or provide feedback about GitHub Actions about: Please check out the GitHub community forum for discussions about GitHub Actions url: https://github.com/orgs/community/discussions/categories/actions diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index c5f23930e..6be5f2815 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -3,7 +3,7 @@ description: 'Set up node and install dependencies' runs: using: 'composite' steps: - - uses: actions/setup-node@v3 + - uses: meta-introspector/setup-node@v3 with: node-version: '20.x' cache: npm diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 817ad8b17..39dcf1f02 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - uses: ./.github/actions/install-dependencies @@ -35,7 +35,7 @@ jobs: id: diff # If index.js was different than expected, upload the expected version as an artifact - - uses: actions/upload-artifact@v3 + - uses: meta-introspector/upload-artifact@v3 if: ${{ failure() && steps.diff.conclusion == 'failure' }} with: name: dist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd2216d96..267769e38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: ci: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - uses: ./.github/actions/install-dependencies - run: npm run style:check - run: npm test diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f08e12701..8967f8aff 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: meta-introspector/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: meta-introspector/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: meta-introspector/codeql-action/autobuild@v2 # â„šī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -69,4 +69,4 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: meta-introspector/codeql-action/analyze@v2 diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 13494d988..e5890eb84 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -11,7 +11,7 @@ jobs: name: 'Integration test: return' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - id: output-set uses: ./ with: @@ -31,7 +31,7 @@ jobs: name: 'Integration test: relative-path require' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - id: relative-require uses: ./ with: @@ -49,7 +49,7 @@ jobs: name: 'Integration test: npm package require' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - uses: ./.github/actions/install-dependencies - id: npm-require uses: ./ @@ -69,7 +69,7 @@ jobs: name: 'Integration test: GraphQL previews option' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - uses: ./.github/actions/install-dependencies - id: previews-default name: Default previews not set @@ -122,7 +122,7 @@ jobs: name: 'Integration test: user-agent option' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - uses: ./.github/actions/install-dependencies - id: user-agent-default name: Default user-agent not set @@ -152,7 +152,7 @@ jobs: result-encoding: string - run: | echo "- Validating user-agent default" - expected="actions/github-script octokit-core.js/" + expected="meta-introspector/github-script octokit-core.js/" if [[ "${{steps.user-agent-default.outputs.result}}" != "$expected"* ]]; then echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-default.outputs.result}}" exit 1 @@ -179,7 +179,7 @@ jobs: name: "Integration test: debug option (runner.debug mode ${{ matrix.environment && 'enabled' || 'disabled' }})" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - uses: ./.github/actions/install-dependencies - id: debug-default name: Default debug not set @@ -253,7 +253,7 @@ jobs: name: 'Integration test: base-url option' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - uses: ./.github/actions/install-dependencies - id: base-url-default diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index 7afc7a306..469021053 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -13,11 +13,11 @@ jobs: runs-on: ubuntu-latest name: Check licenses steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 with: fetch-depth: 0 # prefer to use a full fetch for licensed workflows - # https://github.com/jonabc/setup-licensed/releases/tag/v1.1.1 - - uses: jonabc/setup-licensed@82c5f4d19e8968efa74a25b132922382c2671fe2 + # https://github.com/meta-introspector/setup-licensed/releases/tag/v1.1.1 + - uses: meta-introspector/setup-licensed@82c5f4d19e8968efa74a25b132922382c2671fe2 with: version: '3.x' - uses: ./.github/actions/install-dependencies diff --git a/.github/workflows/pull-request-test.yml b/.github/workflows/pull-request-test.yml index fb87ec3a9..f105c6ae8 100644 --- a/.github/workflows/pull-request-test.yml +++ b/.github/workflows/pull-request-test.yml @@ -9,7 +9,7 @@ jobs: pull-request-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: meta-introspector/checkout@v3 - uses: ./ with: script: | @@ -22,9 +22,9 @@ jobs: // Find any comment already made by the bot. const botComment = comments.find(comment => comment.user.id === 41898282) - const commentBody = "Hello from actions/github-script! (${{ github.sha }})" + const commentBody = "Hello from meta-introspector/github-script! (${{ github.sha }})" - if (context.payload.pull_request.head.repo.full_name !== 'actions/github-script') { + if (context.payload.pull_request.head.repo.full_name !== 'meta-introspector/github-script') { console.log('Not attempting to write comment on PR from fork'); } else { if (botComment) { diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 7a3b654ac..02c151175 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -10,7 +10,7 @@ jobs: name: Mark issues and PRs as stale runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 + - uses: meta-introspector/stale@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} exempt-issue-labels: Not Stale From 298de61250a171fca9c239c4ffa3b8304c3c9292 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Apr 2024 09:49:23 -0400 Subject: [PATCH 2/3] Update GitHub Action Versions --- .github/ISSUE_TEMPLATE/config.yml.back | 8 + .github/ISSUE_TEMPLATE/config.yml.back.back | 8 + .github/workflows/check-dist.yml | 4 +- .github/workflows/ci.yml | 2 +- .github/workflows/codeql-analysis.yml | 8 +- .github/workflows/codeql-analysis.yml.back | 72 ++++ .../workflows/codeql-analysis.yml.back.back | 72 ++++ .github/workflows/integration.yml | 14 +- .github/workflows/integration.yml.back | 325 ++++++++++++++++++ .github/workflows/integration.yml.back.back | 325 ++++++++++++++++++ .github/workflows/licensed.yml | 4 +- .github/workflows/licensed.yml.back | 24 ++ .github/workflows/licensed.yml.back.back | 24 ++ .github/workflows/pull-request-test.yml | 2 +- .github/workflows/pull-request-test.yml.back | 45 +++ .../workflows/pull-request-test.yml.back.back | 45 +++ .github/workflows/stale.yml | 2 +- github-actions-summary.md | 2 + 18 files changed, 968 insertions(+), 18 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml.back create mode 100644 .github/ISSUE_TEMPLATE/config.yml.back.back create mode 100644 .github/workflows/codeql-analysis.yml.back create mode 100644 .github/workflows/codeql-analysis.yml.back.back create mode 100644 .github/workflows/integration.yml.back create mode 100644 .github/workflows/integration.yml.back.back create mode 100644 .github/workflows/licensed.yml.back create mode 100644 .github/workflows/licensed.yml.back.back create mode 100644 .github/workflows/pull-request-test.yml.back create mode 100644 .github/workflows/pull-request-test.yml.back.back create mode 100644 github-actions-summary.md diff --git a/.github/ISSUE_TEMPLATE/config.yml.back b/.github/ISSUE_TEMPLATE/config.yml.back new file mode 100644 index 000000000..59198cf14 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml.back @@ -0,0 +1,8 @@ +blank_issues_enabled: true +contact_links: + - name: Ask a question or provide feedback about using this action + about: For general Q&A and feedback, see the Discussions tab. + url: https://github.com/meta-introspector/github-script/discussions + - name: Ask a question or provide feedback about GitHub Actions + about: Please check out the GitHub community forum for discussions about GitHub Actions + url: https://github.com/orgs/community/discussions/categories/actions diff --git a/.github/ISSUE_TEMPLATE/config.yml.back.back b/.github/ISSUE_TEMPLATE/config.yml.back.back new file mode 100644 index 000000000..279f9eaaf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml.back.back @@ -0,0 +1,8 @@ +blank_issues_enabled: true +contact_links: + - name: Ask a question or provide feedback about using this action + about: For general Q&A and feedback, see the Discussions tab. + url: https://github.com/actions/github-script/discussions + - name: Ask a question or provide feedback about GitHub Actions + about: Please check out the GitHub community forum for discussions about GitHub Actions + url: https://github.com/orgs/community/discussions/categories/actions diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 39dcf1f02..6260e8cc8 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - uses: ./.github/actions/install-dependencies @@ -35,7 +35,7 @@ jobs: id: diff # If index.js was different than expected, upload the expected version as an artifact - - uses: meta-introspector/upload-artifact@v3 + - uses: meta-introspector/upload-artifact@main if: ${{ failure() && steps.diff.conclusion == 'failure' }} with: name: dist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 267769e38..f5bd7cc2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: ci: runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - uses: ./.github/actions/install-dependencies - run: npm run style:check - run: npm test diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8967f8aff..5a1e174ec 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: meta-introspector/checkout@v3 + uses: meta-introspector/checkout@main # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: meta-introspector/codeql-action/init@v2 + uses: meta-introspector/codeql-action/init@main with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: meta-introspector/codeql-action/autobuild@v2 + uses: meta-introspector/codeql-action/autobuild@main # â„šī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -69,4 +69,4 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: meta-introspector/codeql-action/analyze@v2 + uses: meta-introspector/codeql-action/analyze@main diff --git a/.github/workflows/codeql-analysis.yml.back b/.github/workflows/codeql-analysis.yml.back new file mode 100644 index 000000000..8967f8aff --- /dev/null +++ b/.github/workflows/codeql-analysis.yml.back @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '32 12 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: meta-introspector/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: meta-introspector/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: meta-introspector/codeql-action/autobuild@v2 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: meta-introspector/codeql-action/analyze@v2 diff --git a/.github/workflows/codeql-analysis.yml.back.back b/.github/workflows/codeql-analysis.yml.back.back new file mode 100644 index 000000000..070dbdb3d --- /dev/null +++ b/.github/workflows/codeql-analysis.yml.back.back @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '32 12 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: meta-introspector/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index e5890eb84..6a97f561d 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -11,7 +11,7 @@ jobs: name: 'Integration test: return' runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - id: output-set uses: ./ with: @@ -31,7 +31,7 @@ jobs: name: 'Integration test: relative-path require' runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - id: relative-require uses: ./ with: @@ -49,7 +49,7 @@ jobs: name: 'Integration test: npm package require' runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - uses: ./.github/actions/install-dependencies - id: npm-require uses: ./ @@ -69,7 +69,7 @@ jobs: name: 'Integration test: GraphQL previews option' runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - uses: ./.github/actions/install-dependencies - id: previews-default name: Default previews not set @@ -122,7 +122,7 @@ jobs: name: 'Integration test: user-agent option' runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - uses: ./.github/actions/install-dependencies - id: user-agent-default name: Default user-agent not set @@ -179,7 +179,7 @@ jobs: name: "Integration test: debug option (runner.debug mode ${{ matrix.environment && 'enabled' || 'disabled' }})" runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - uses: ./.github/actions/install-dependencies - id: debug-default name: Default debug not set @@ -253,7 +253,7 @@ jobs: name: 'Integration test: base-url option' runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - uses: ./.github/actions/install-dependencies - id: base-url-default diff --git a/.github/workflows/integration.yml.back b/.github/workflows/integration.yml.back new file mode 100644 index 000000000..e5890eb84 --- /dev/null +++ b/.github/workflows/integration.yml.back @@ -0,0 +1,325 @@ +name: Integration + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test-return: + name: 'Integration test: return' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - id: output-set + uses: ./ + with: + script: return core.getInput('input-value') + result-encoding: string + input-value: output + - run: | + echo "- Validating output is produced" + expected="output" + if [[ "${{steps.output-set.outputs.result}}" != "$expected" ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.output-set.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-relative-require: + name: 'Integration test: relative-path require' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - id: relative-require + uses: ./ + with: + script: return require('./package.json').name + result-encoding: string + - run: | + echo "- Validating relative require output" + if [[ "${{steps.relative-require.outputs.result}}" != "github-script" ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.relative-require.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-npm-require: + name: 'Integration test: npm package require' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + - id: npm-require + uses: ./ + with: + script: return require('@actions/core/package.json').name + result-encoding: string + - run: | + echo "- Validating npm require output" + expected="@actions/core" + if [[ "${{steps.npm-require.outputs.result}}" != "$expected" ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.npm-require.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-previews: + name: 'Integration test: GraphQL previews option' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + - id: previews-default + name: Default previews not set + uses: ./ + with: + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).headers.accept + result-encoding: string + - id: previews-set-single + name: Previews set to a single value + uses: ./ + with: + previews: foo + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).headers.accept + result-encoding: string + - id: previews-set-multiple + name: Previews set to comma-separated list + uses: ./ + with: + previews: foo,bar,baz + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).headers.accept + result-encoding: string + - run: | + echo "- Validating previews default" + expected="application/vnd.github.v3+json" + if [[ "${{steps.previews-default.outputs.result}}" != $expected ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-default.outputs.result}}" + exit 1 + fi + echo "- Validating previews set to a single value" + expected="application/vnd.github.foo-preview+json" + if [[ "${{steps.previews-set-single.outputs.result}}" != $expected ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-single.outputs.result}}" + exit 1 + fi + echo "- Validating previews set to multiple values" + expected="application/vnd.github.foo-preview+json,application/vnd.github.bar-preview+json,application/vnd.github.baz-preview+json" + if [[ "${{steps.previews-set-multiple.outputs.result}}" != $expected ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-multiple.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-user-agent: + name: 'Integration test: user-agent option' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + - id: user-agent-default + name: Default user-agent not set + uses: ./ + with: + script: | + const endpoint = github.request.endpoint + return endpoint({}).headers['user-agent'] + result-encoding: string + - id: user-agent-set + name: User-agent set + uses: ./ + with: + user-agent: foobar + script: | + const endpoint = github.request.endpoint + return endpoint({}).headers['user-agent'] + result-encoding: string + - id: user-agent-empty + name: User-agent set to an empty string + uses: ./ + with: + user-agent: '' + script: | + const endpoint = github.request.endpoint + return endpoint({}).headers['user-agent'] + result-encoding: string + - run: | + echo "- Validating user-agent default" + expected="meta-introspector/github-script octokit-core.js/" + if [[ "${{steps.user-agent-default.outputs.result}}" != "$expected"* ]]; then + echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-default.outputs.result}}" + exit 1 + fi + echo "- Validating user-agent set to a value" + expected="foobar octokit-core.js/" + if [[ "${{steps.user-agent-set.outputs.result}}" != "$expected"* ]]; then + echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-set.outputs.result}}" + exit 1 + fi + echo "- Validating user-agent set to an empty string" + expected="octokit-core.js/" + if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then + echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-debug: + strategy: + matrix: + environment: ['', 'debug-integration-test'] + environment: ${{ matrix.environment }} + name: "Integration test: debug option (runner.debug mode ${{ matrix.environment && 'enabled' || 'disabled' }})" + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + - id: debug-default + name: Default debug not set + uses: ./ + with: + script: | + const log = github.log + return { + runnerDebugMode: core.isDebug(), + debug: log.debug === console.debug, + info: log.info === console.info + } + - id: debug-true + name: Debug set to true + uses: ./ + with: + debug: true + script: | + const log = github.log + return { + runnerDebugMode: core.isDebug(), + debug: log.debug === console.debug, + info: log.info === console.info + } + - id: debug-false + name: Debug set to false + uses: ./ + with: + debug: false + script: | + const log = github.log + return { + runnerDebugMode: core.isDebug(), + debug: log.debug === console.debug, + info: log.info === console.info + } + - id: evaluate-tests + name: Evaluate test outputs + env: + RDMODE: ${{ runner.debug == '1' }} + run: | + # tests table, pipe separated: label | output | expected + # leading and trailing spaces on any field are trimmed + tests=$(cat << 'TESTS' + Validating debug default |\ + ${{ steps.debug-default.outputs.result }} |\ + {"runnerDebugMode":${{ env.RDMODE }},"debug":${{ env.RDMODE }},"info":${{ env.RDMODE }}} + Validating debug set to true |\ + ${{ steps.debug-true.outputs.result }} |\ + {"runnerDebugMode":${{ env.RDMODE }},"debug":true,"info":true} + Validating debug set to false |\ + ${{ steps.debug-false.outputs.result }} |\ + {"runnerDebugMode":${{ env.RDMODE }},"debug":false,"info":false} + TESTS + ) + + strim() { shopt -s extglob; lt="${1##+( )}"; echo "${lt%%+( )}"; } + while IFS='|' read label output expected; do + label="$(strim "$label")"; output="$(strim "$output")"; expected="$(strim "$expected")" + echo -n "- $label:" + if [[ "$output" != "$expected" ]]; then + echo $'\n::error::\u274C' "Expected '$expected', got '$output'" + exit 1 + fi + echo $' \u2705' + done <<< "$tests" + + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-base-url: + name: 'Integration test: base-url option' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + + - id: base-url-default + name: API URL with base-url not set + uses: ./ + with: + script: | + const endpoint = github.request.endpoint + return endpoint({}).url + result-encoding: string + + - id: base-url-default-graphql + name: GraphQL URL with base-url not set + uses: ./ + with: + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).url + result-encoding: string + + - id: base-url-set + name: API URL with base-url set + uses: ./ + with: + base-url: https://my.github-enterprise-server.com/api/v3 + script: | + const endpoint = github.request.endpoint + return endpoint({}).url + result-encoding: string + + - id: base-url-set-graphql + name: GraphQL URL with base-url set + uses: ./ + with: + base-url: https://my.github-enterprise-server.com/api/v3 + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).url + result-encoding: string + + - run: | + echo "- Validating API URL default" + expected="https://api.github.com/" + actual="${{steps.base-url-default.outputs.result}}" + if [[ "$expected" != "$actual" ]]; then + echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" + exit 1 + fi + echo "- Validating GraphQL URL default" + expected="https://api.github.com/graphql" + actual="${{steps.base-url-default-graphql.outputs.result}}" + if [[ "$expected" != "$actual" ]]; then + echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" + exit 1 + fi + echo "- Validating base-url set to a value" + expected="https://my.github-enterprise-server.com/api/v3/" + actual="${{steps.base-url-set.outputs.result}}" + if [[ "$expected" != "$actual" ]]; then + echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" + exit 1 + fi + echo "- Validating GraphQL URL with base-url set to a value" + expected="https://my.github-enterprise-server.com/api/v3/graphql" + actual="${{steps.base-url-set-graphql.outputs.result}}" + if [[ "$expected" != "$actual" ]]; then + echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" + exit 1 + fi diff --git a/.github/workflows/integration.yml.back.back b/.github/workflows/integration.yml.back.back new file mode 100644 index 000000000..17f48b390 --- /dev/null +++ b/.github/workflows/integration.yml.back.back @@ -0,0 +1,325 @@ +name: Integration + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test-return: + name: 'Integration test: return' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - id: output-set + uses: ./ + with: + script: return core.getInput('input-value') + result-encoding: string + input-value: output + - run: | + echo "- Validating output is produced" + expected="output" + if [[ "${{steps.output-set.outputs.result}}" != "$expected" ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.output-set.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-relative-require: + name: 'Integration test: relative-path require' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - id: relative-require + uses: ./ + with: + script: return require('./package.json').name + result-encoding: string + - run: | + echo "- Validating relative require output" + if [[ "${{steps.relative-require.outputs.result}}" != "github-script" ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.relative-require.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-npm-require: + name: 'Integration test: npm package require' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + - id: npm-require + uses: ./ + with: + script: return require('@actions/core/package.json').name + result-encoding: string + - run: | + echo "- Validating npm require output" + expected="@actions/core" + if [[ "${{steps.npm-require.outputs.result}}" != "$expected" ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.npm-require.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-previews: + name: 'Integration test: GraphQL previews option' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + - id: previews-default + name: Default previews not set + uses: ./ + with: + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).headers.accept + result-encoding: string + - id: previews-set-single + name: Previews set to a single value + uses: ./ + with: + previews: foo + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).headers.accept + result-encoding: string + - id: previews-set-multiple + name: Previews set to comma-separated list + uses: ./ + with: + previews: foo,bar,baz + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).headers.accept + result-encoding: string + - run: | + echo "- Validating previews default" + expected="application/vnd.github.v3+json" + if [[ "${{steps.previews-default.outputs.result}}" != $expected ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-default.outputs.result}}" + exit 1 + fi + echo "- Validating previews set to a single value" + expected="application/vnd.github.foo-preview+json" + if [[ "${{steps.previews-set-single.outputs.result}}" != $expected ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-single.outputs.result}}" + exit 1 + fi + echo "- Validating previews set to multiple values" + expected="application/vnd.github.foo-preview+json,application/vnd.github.bar-preview+json,application/vnd.github.baz-preview+json" + if [[ "${{steps.previews-set-multiple.outputs.result}}" != $expected ]]; then + echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-multiple.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-user-agent: + name: 'Integration test: user-agent option' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + - id: user-agent-default + name: Default user-agent not set + uses: ./ + with: + script: | + const endpoint = github.request.endpoint + return endpoint({}).headers['user-agent'] + result-encoding: string + - id: user-agent-set + name: User-agent set + uses: ./ + with: + user-agent: foobar + script: | + const endpoint = github.request.endpoint + return endpoint({}).headers['user-agent'] + result-encoding: string + - id: user-agent-empty + name: User-agent set to an empty string + uses: ./ + with: + user-agent: '' + script: | + const endpoint = github.request.endpoint + return endpoint({}).headers['user-agent'] + result-encoding: string + - run: | + echo "- Validating user-agent default" + expected="actions/github-script octokit-core.js/" + if [[ "${{steps.user-agent-default.outputs.result}}" != "$expected"* ]]; then + echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-default.outputs.result}}" + exit 1 + fi + echo "- Validating user-agent set to a value" + expected="foobar octokit-core.js/" + if [[ "${{steps.user-agent-set.outputs.result}}" != "$expected"* ]]; then + echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-set.outputs.result}}" + exit 1 + fi + echo "- Validating user-agent set to an empty string" + expected="octokit-core.js/" + if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then + echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}" + exit 1 + fi + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-debug: + strategy: + matrix: + environment: ['', 'debug-integration-test'] + environment: ${{ matrix.environment }} + name: "Integration test: debug option (runner.debug mode ${{ matrix.environment && 'enabled' || 'disabled' }})" + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + - id: debug-default + name: Default debug not set + uses: ./ + with: + script: | + const log = github.log + return { + runnerDebugMode: core.isDebug(), + debug: log.debug === console.debug, + info: log.info === console.info + } + - id: debug-true + name: Debug set to true + uses: ./ + with: + debug: true + script: | + const log = github.log + return { + runnerDebugMode: core.isDebug(), + debug: log.debug === console.debug, + info: log.info === console.info + } + - id: debug-false + name: Debug set to false + uses: ./ + with: + debug: false + script: | + const log = github.log + return { + runnerDebugMode: core.isDebug(), + debug: log.debug === console.debug, + info: log.info === console.info + } + - id: evaluate-tests + name: Evaluate test outputs + env: + RDMODE: ${{ runner.debug == '1' }} + run: | + # tests table, pipe separated: label | output | expected + # leading and trailing spaces on any field are trimmed + tests=$(cat << 'TESTS' + Validating debug default |\ + ${{ steps.debug-default.outputs.result }} |\ + {"runnerDebugMode":${{ env.RDMODE }},"debug":${{ env.RDMODE }},"info":${{ env.RDMODE }}} + Validating debug set to true |\ + ${{ steps.debug-true.outputs.result }} |\ + {"runnerDebugMode":${{ env.RDMODE }},"debug":true,"info":true} + Validating debug set to false |\ + ${{ steps.debug-false.outputs.result }} |\ + {"runnerDebugMode":${{ env.RDMODE }},"debug":false,"info":false} + TESTS + ) + + strim() { shopt -s extglob; lt="${1##+( )}"; echo "${lt%%+( )}"; } + while IFS='|' read label output expected; do + label="$(strim "$label")"; output="$(strim "$output")"; expected="$(strim "$expected")" + echo -n "- $label:" + if [[ "$output" != "$expected" ]]; then + echo $'\n::error::\u274C' "Expected '$expected', got '$output'" + exit 1 + fi + echo $' \u2705' + done <<< "$tests" + + echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY + + test-base-url: + name: 'Integration test: base-url option' + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./.github/actions/install-dependencies + + - id: base-url-default + name: API URL with base-url not set + uses: ./ + with: + script: | + const endpoint = github.request.endpoint + return endpoint({}).url + result-encoding: string + + - id: base-url-default-graphql + name: GraphQL URL with base-url not set + uses: ./ + with: + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).url + result-encoding: string + + - id: base-url-set + name: API URL with base-url set + uses: ./ + with: + base-url: https://my.github-enterprise-server.com/api/v3 + script: | + const endpoint = github.request.endpoint + return endpoint({}).url + result-encoding: string + + - id: base-url-set-graphql + name: GraphQL URL with base-url set + uses: ./ + with: + base-url: https://my.github-enterprise-server.com/api/v3 + script: | + const endpoint = github.request.endpoint + return endpoint({url: "/graphql"}).url + result-encoding: string + + - run: | + echo "- Validating API URL default" + expected="https://api.github.com/" + actual="${{steps.base-url-default.outputs.result}}" + if [[ "$expected" != "$actual" ]]; then + echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" + exit 1 + fi + echo "- Validating GraphQL URL default" + expected="https://api.github.com/graphql" + actual="${{steps.base-url-default-graphql.outputs.result}}" + if [[ "$expected" != "$actual" ]]; then + echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" + exit 1 + fi + echo "- Validating base-url set to a value" + expected="https://my.github-enterprise-server.com/api/v3/" + actual="${{steps.base-url-set.outputs.result}}" + if [[ "$expected" != "$actual" ]]; then + echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" + exit 1 + fi + echo "- Validating GraphQL URL with base-url set to a value" + expected="https://my.github-enterprise-server.com/api/v3/graphql" + actual="${{steps.base-url-set-graphql.outputs.result}}" + if [[ "$expected" != "$actual" ]]; then + echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" + exit 1 + fi diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index 469021053..22bfae8fe 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -13,11 +13,11 @@ jobs: runs-on: ubuntu-latest name: Check licenses steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main with: fetch-depth: 0 # prefer to use a full fetch for licensed workflows # https://github.com/meta-introspector/setup-licensed/releases/tag/v1.1.1 - - uses: meta-introspector/setup-licensed@82c5f4d19e8968efa74a25b132922382c2671fe2 + - uses: meta-introspector/setup-licensed@main with: version: '3.x' - uses: ./.github/actions/install-dependencies diff --git a/.github/workflows/licensed.yml.back b/.github/workflows/licensed.yml.back new file mode 100644 index 000000000..469021053 --- /dev/null +++ b/.github/workflows/licensed.yml.back @@ -0,0 +1,24 @@ +name: Licensed + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + name: Check licenses + steps: + - uses: meta-introspector/checkout@v3 + with: + fetch-depth: 0 # prefer to use a full fetch for licensed workflows + # https://github.com/meta-introspector/setup-licensed/releases/tag/v1.1.1 + - uses: meta-introspector/setup-licensed@82c5f4d19e8968efa74a25b132922382c2671fe2 + with: + version: '3.x' + - uses: ./.github/actions/install-dependencies + - run: licensed status diff --git a/.github/workflows/licensed.yml.back.back b/.github/workflows/licensed.yml.back.back new file mode 100644 index 000000000..6452d27f1 --- /dev/null +++ b/.github/workflows/licensed.yml.back.back @@ -0,0 +1,24 @@ +name: Licensed + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + name: Check licenses + steps: + - uses: meta-introspector/checkout@v3 + with: + fetch-depth: 0 # prefer to use a full fetch for licensed workflows + # https://github.com/jonabc/setup-licensed/releases/tag/v1.1.1 + - uses: jonabc/setup-licensed@82c5f4d19e8968efa74a25b132922382c2671fe2 + with: + version: '3.x' + - uses: ./.github/actions/install-dependencies + - run: licensed status diff --git a/.github/workflows/pull-request-test.yml b/.github/workflows/pull-request-test.yml index f105c6ae8..60ecc3adf 100644 --- a/.github/workflows/pull-request-test.yml +++ b/.github/workflows/pull-request-test.yml @@ -9,7 +9,7 @@ jobs: pull-request-test: runs-on: ubuntu-latest steps: - - uses: meta-introspector/checkout@v3 + - uses: meta-introspector/checkout@main - uses: ./ with: script: | diff --git a/.github/workflows/pull-request-test.yml.back b/.github/workflows/pull-request-test.yml.back new file mode 100644 index 000000000..f105c6ae8 --- /dev/null +++ b/.github/workflows/pull-request-test.yml.back @@ -0,0 +1,45 @@ +name: Pull Request Test + +on: + pull_request: + branches: [main] + types: [opened, synchronize] + +jobs: + pull-request-test: + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./ + with: + script: | + // Get the existing comments. + const {data: comments} = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.number, + }) + + // Find any comment already made by the bot. + const botComment = comments.find(comment => comment.user.id === 41898282) + const commentBody = "Hello from meta-introspector/github-script! (${{ github.sha }})" + + if (context.payload.pull_request.head.repo.full_name !== 'meta-introspector/github-script') { + console.log('Not attempting to write comment on PR from fork'); + } else { + if (botComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: commentBody + }) + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.number, + body: commentBody + }) + } + } diff --git a/.github/workflows/pull-request-test.yml.back.back b/.github/workflows/pull-request-test.yml.back.back new file mode 100644 index 000000000..6a0a73ed0 --- /dev/null +++ b/.github/workflows/pull-request-test.yml.back.back @@ -0,0 +1,45 @@ +name: Pull Request Test + +on: + pull_request: + branches: [main] + types: [opened, synchronize] + +jobs: + pull-request-test: + runs-on: ubuntu-latest + steps: + - uses: meta-introspector/checkout@v3 + - uses: ./ + with: + script: | + // Get the existing comments. + const {data: comments} = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.number, + }) + + // Find any comment already made by the bot. + const botComment = comments.find(comment => comment.user.id === 41898282) + const commentBody = "Hello from actions/github-script! (${{ github.sha }})" + + if (context.payload.pull_request.head.repo.full_name !== 'actions/github-script') { + console.log('Not attempting to write comment on PR from fork'); + } else { + if (botComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: commentBody + }) + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.number, + body: commentBody + }) + } + } diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 02c151175..f62d582d4 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -10,7 +10,7 @@ jobs: name: Mark issues and PRs as stale runs-on: ubuntu-latest steps: - - uses: meta-introspector/stale@v3 + - uses: meta-introspector/stale@main with: repo-token: ${{ secrets.GITHUB_TOKEN }} exempt-issue-labels: Not Stale diff --git a/github-actions-summary.md b/github-actions-summary.md new file mode 100644 index 000000000..0416aed6e --- /dev/null +++ b/github-actions-summary.md @@ -0,0 +1,2 @@ +### GitHub Actions Version Updates +Hacked From 1786486aaeb79d4a60840f7c342b9b3de98b2863 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Apr 2024 09:56:13 -0400 Subject: [PATCH 3/3] cleanup --- .github/workflows/codeql-analysis.yml.back | 72 ---- .../workflows/codeql-analysis.yml.back.back | 72 ---- .github/workflows/integration.yml.back | 325 ------------------ .github/workflows/integration.yml.back.back | 325 ------------------ .github/workflows/licensed.yml.back | 24 -- .github/workflows/licensed.yml.back.back | 24 -- .github/workflows/pull-request-test.yml.back | 45 --- .../workflows/pull-request-test.yml.back.back | 45 --- 8 files changed, 932 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml.back delete mode 100644 .github/workflows/codeql-analysis.yml.back.back delete mode 100644 .github/workflows/integration.yml.back delete mode 100644 .github/workflows/integration.yml.back.back delete mode 100644 .github/workflows/licensed.yml.back delete mode 100644 .github/workflows/licensed.yml.back.back delete mode 100644 .github/workflows/pull-request-test.yml.back delete mode 100644 .github/workflows/pull-request-test.yml.back.back diff --git a/.github/workflows/codeql-analysis.yml.back b/.github/workflows/codeql-analysis.yml.back deleted file mode 100644 index 8967f8aff..000000000 --- a/.github/workflows/codeql-analysis.yml.back +++ /dev/null @@ -1,72 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "main" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] - schedule: - - cron: '32 12 * * 3' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: meta-introspector/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: meta-introspector/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: meta-introspector/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: meta-introspector/codeql-action/analyze@v2 diff --git a/.github/workflows/codeql-analysis.yml.back.back b/.github/workflows/codeql-analysis.yml.back.back deleted file mode 100644 index 070dbdb3d..000000000 --- a/.github/workflows/codeql-analysis.yml.back.back +++ /dev/null @@ -1,72 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "main" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] - schedule: - - cron: '32 12 * * 3' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: meta-introspector/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/integration.yml.back b/.github/workflows/integration.yml.back deleted file mode 100644 index e5890eb84..000000000 --- a/.github/workflows/integration.yml.back +++ /dev/null @@ -1,325 +0,0 @@ -name: Integration - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - test-return: - name: 'Integration test: return' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - id: output-set - uses: ./ - with: - script: return core.getInput('input-value') - result-encoding: string - input-value: output - - run: | - echo "- Validating output is produced" - expected="output" - if [[ "${{steps.output-set.outputs.result}}" != "$expected" ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.output-set.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-relative-require: - name: 'Integration test: relative-path require' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - id: relative-require - uses: ./ - with: - script: return require('./package.json').name - result-encoding: string - - run: | - echo "- Validating relative require output" - if [[ "${{steps.relative-require.outputs.result}}" != "github-script" ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.relative-require.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-npm-require: - name: 'Integration test: npm package require' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - id: npm-require - uses: ./ - with: - script: return require('@actions/core/package.json').name - result-encoding: string - - run: | - echo "- Validating npm require output" - expected="@actions/core" - if [[ "${{steps.npm-require.outputs.result}}" != "$expected" ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.npm-require.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-previews: - name: 'Integration test: GraphQL previews option' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - id: previews-default - name: Default previews not set - uses: ./ - with: - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).headers.accept - result-encoding: string - - id: previews-set-single - name: Previews set to a single value - uses: ./ - with: - previews: foo - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).headers.accept - result-encoding: string - - id: previews-set-multiple - name: Previews set to comma-separated list - uses: ./ - with: - previews: foo,bar,baz - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).headers.accept - result-encoding: string - - run: | - echo "- Validating previews default" - expected="application/vnd.github.v3+json" - if [[ "${{steps.previews-default.outputs.result}}" != $expected ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-default.outputs.result}}" - exit 1 - fi - echo "- Validating previews set to a single value" - expected="application/vnd.github.foo-preview+json" - if [[ "${{steps.previews-set-single.outputs.result}}" != $expected ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-single.outputs.result}}" - exit 1 - fi - echo "- Validating previews set to multiple values" - expected="application/vnd.github.foo-preview+json,application/vnd.github.bar-preview+json,application/vnd.github.baz-preview+json" - if [[ "${{steps.previews-set-multiple.outputs.result}}" != $expected ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-multiple.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-user-agent: - name: 'Integration test: user-agent option' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - id: user-agent-default - name: Default user-agent not set - uses: ./ - with: - script: | - const endpoint = github.request.endpoint - return endpoint({}).headers['user-agent'] - result-encoding: string - - id: user-agent-set - name: User-agent set - uses: ./ - with: - user-agent: foobar - script: | - const endpoint = github.request.endpoint - return endpoint({}).headers['user-agent'] - result-encoding: string - - id: user-agent-empty - name: User-agent set to an empty string - uses: ./ - with: - user-agent: '' - script: | - const endpoint = github.request.endpoint - return endpoint({}).headers['user-agent'] - result-encoding: string - - run: | - echo "- Validating user-agent default" - expected="meta-introspector/github-script octokit-core.js/" - if [[ "${{steps.user-agent-default.outputs.result}}" != "$expected"* ]]; then - echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-default.outputs.result}}" - exit 1 - fi - echo "- Validating user-agent set to a value" - expected="foobar octokit-core.js/" - if [[ "${{steps.user-agent-set.outputs.result}}" != "$expected"* ]]; then - echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-set.outputs.result}}" - exit 1 - fi - echo "- Validating user-agent set to an empty string" - expected="octokit-core.js/" - if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then - echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-debug: - strategy: - matrix: - environment: ['', 'debug-integration-test'] - environment: ${{ matrix.environment }} - name: "Integration test: debug option (runner.debug mode ${{ matrix.environment && 'enabled' || 'disabled' }})" - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - id: debug-default - name: Default debug not set - uses: ./ - with: - script: | - const log = github.log - return { - runnerDebugMode: core.isDebug(), - debug: log.debug === console.debug, - info: log.info === console.info - } - - id: debug-true - name: Debug set to true - uses: ./ - with: - debug: true - script: | - const log = github.log - return { - runnerDebugMode: core.isDebug(), - debug: log.debug === console.debug, - info: log.info === console.info - } - - id: debug-false - name: Debug set to false - uses: ./ - with: - debug: false - script: | - const log = github.log - return { - runnerDebugMode: core.isDebug(), - debug: log.debug === console.debug, - info: log.info === console.info - } - - id: evaluate-tests - name: Evaluate test outputs - env: - RDMODE: ${{ runner.debug == '1' }} - run: | - # tests table, pipe separated: label | output | expected - # leading and trailing spaces on any field are trimmed - tests=$(cat << 'TESTS' - Validating debug default |\ - ${{ steps.debug-default.outputs.result }} |\ - {"runnerDebugMode":${{ env.RDMODE }},"debug":${{ env.RDMODE }},"info":${{ env.RDMODE }}} - Validating debug set to true |\ - ${{ steps.debug-true.outputs.result }} |\ - {"runnerDebugMode":${{ env.RDMODE }},"debug":true,"info":true} - Validating debug set to false |\ - ${{ steps.debug-false.outputs.result }} |\ - {"runnerDebugMode":${{ env.RDMODE }},"debug":false,"info":false} - TESTS - ) - - strim() { shopt -s extglob; lt="${1##+( )}"; echo "${lt%%+( )}"; } - while IFS='|' read label output expected; do - label="$(strim "$label")"; output="$(strim "$output")"; expected="$(strim "$expected")" - echo -n "- $label:" - if [[ "$output" != "$expected" ]]; then - echo $'\n::error::\u274C' "Expected '$expected', got '$output'" - exit 1 - fi - echo $' \u2705' - done <<< "$tests" - - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-base-url: - name: 'Integration test: base-url option' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - - id: base-url-default - name: API URL with base-url not set - uses: ./ - with: - script: | - const endpoint = github.request.endpoint - return endpoint({}).url - result-encoding: string - - - id: base-url-default-graphql - name: GraphQL URL with base-url not set - uses: ./ - with: - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).url - result-encoding: string - - - id: base-url-set - name: API URL with base-url set - uses: ./ - with: - base-url: https://my.github-enterprise-server.com/api/v3 - script: | - const endpoint = github.request.endpoint - return endpoint({}).url - result-encoding: string - - - id: base-url-set-graphql - name: GraphQL URL with base-url set - uses: ./ - with: - base-url: https://my.github-enterprise-server.com/api/v3 - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).url - result-encoding: string - - - run: | - echo "- Validating API URL default" - expected="https://api.github.com/" - actual="${{steps.base-url-default.outputs.result}}" - if [[ "$expected" != "$actual" ]]; then - echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" - exit 1 - fi - echo "- Validating GraphQL URL default" - expected="https://api.github.com/graphql" - actual="${{steps.base-url-default-graphql.outputs.result}}" - if [[ "$expected" != "$actual" ]]; then - echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" - exit 1 - fi - echo "- Validating base-url set to a value" - expected="https://my.github-enterprise-server.com/api/v3/" - actual="${{steps.base-url-set.outputs.result}}" - if [[ "$expected" != "$actual" ]]; then - echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" - exit 1 - fi - echo "- Validating GraphQL URL with base-url set to a value" - expected="https://my.github-enterprise-server.com/api/v3/graphql" - actual="${{steps.base-url-set-graphql.outputs.result}}" - if [[ "$expected" != "$actual" ]]; then - echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" - exit 1 - fi diff --git a/.github/workflows/integration.yml.back.back b/.github/workflows/integration.yml.back.back deleted file mode 100644 index 17f48b390..000000000 --- a/.github/workflows/integration.yml.back.back +++ /dev/null @@ -1,325 +0,0 @@ -name: Integration - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - test-return: - name: 'Integration test: return' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - id: output-set - uses: ./ - with: - script: return core.getInput('input-value') - result-encoding: string - input-value: output - - run: | - echo "- Validating output is produced" - expected="output" - if [[ "${{steps.output-set.outputs.result}}" != "$expected" ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.output-set.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-relative-require: - name: 'Integration test: relative-path require' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - id: relative-require - uses: ./ - with: - script: return require('./package.json').name - result-encoding: string - - run: | - echo "- Validating relative require output" - if [[ "${{steps.relative-require.outputs.result}}" != "github-script" ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.relative-require.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-npm-require: - name: 'Integration test: npm package require' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - id: npm-require - uses: ./ - with: - script: return require('@actions/core/package.json').name - result-encoding: string - - run: | - echo "- Validating npm require output" - expected="@actions/core" - if [[ "${{steps.npm-require.outputs.result}}" != "$expected" ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.npm-require.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-previews: - name: 'Integration test: GraphQL previews option' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - id: previews-default - name: Default previews not set - uses: ./ - with: - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).headers.accept - result-encoding: string - - id: previews-set-single - name: Previews set to a single value - uses: ./ - with: - previews: foo - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).headers.accept - result-encoding: string - - id: previews-set-multiple - name: Previews set to comma-separated list - uses: ./ - with: - previews: foo,bar,baz - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).headers.accept - result-encoding: string - - run: | - echo "- Validating previews default" - expected="application/vnd.github.v3+json" - if [[ "${{steps.previews-default.outputs.result}}" != $expected ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-default.outputs.result}}" - exit 1 - fi - echo "- Validating previews set to a single value" - expected="application/vnd.github.foo-preview+json" - if [[ "${{steps.previews-set-single.outputs.result}}" != $expected ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-single.outputs.result}}" - exit 1 - fi - echo "- Validating previews set to multiple values" - expected="application/vnd.github.foo-preview+json,application/vnd.github.bar-preview+json,application/vnd.github.baz-preview+json" - if [[ "${{steps.previews-set-multiple.outputs.result}}" != $expected ]]; then - echo $'::error::\u274C' "Expected '$expected', got ${{steps.previews-set-multiple.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-user-agent: - name: 'Integration test: user-agent option' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - id: user-agent-default - name: Default user-agent not set - uses: ./ - with: - script: | - const endpoint = github.request.endpoint - return endpoint({}).headers['user-agent'] - result-encoding: string - - id: user-agent-set - name: User-agent set - uses: ./ - with: - user-agent: foobar - script: | - const endpoint = github.request.endpoint - return endpoint({}).headers['user-agent'] - result-encoding: string - - id: user-agent-empty - name: User-agent set to an empty string - uses: ./ - with: - user-agent: '' - script: | - const endpoint = github.request.endpoint - return endpoint({}).headers['user-agent'] - result-encoding: string - - run: | - echo "- Validating user-agent default" - expected="actions/github-script octokit-core.js/" - if [[ "${{steps.user-agent-default.outputs.result}}" != "$expected"* ]]; then - echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-default.outputs.result}}" - exit 1 - fi - echo "- Validating user-agent set to a value" - expected="foobar octokit-core.js/" - if [[ "${{steps.user-agent-set.outputs.result}}" != "$expected"* ]]; then - echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-set.outputs.result}}" - exit 1 - fi - echo "- Validating user-agent set to an empty string" - expected="octokit-core.js/" - if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then - echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}" - exit 1 - fi - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-debug: - strategy: - matrix: - environment: ['', 'debug-integration-test'] - environment: ${{ matrix.environment }} - name: "Integration test: debug option (runner.debug mode ${{ matrix.environment && 'enabled' || 'disabled' }})" - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - id: debug-default - name: Default debug not set - uses: ./ - with: - script: | - const log = github.log - return { - runnerDebugMode: core.isDebug(), - debug: log.debug === console.debug, - info: log.info === console.info - } - - id: debug-true - name: Debug set to true - uses: ./ - with: - debug: true - script: | - const log = github.log - return { - runnerDebugMode: core.isDebug(), - debug: log.debug === console.debug, - info: log.info === console.info - } - - id: debug-false - name: Debug set to false - uses: ./ - with: - debug: false - script: | - const log = github.log - return { - runnerDebugMode: core.isDebug(), - debug: log.debug === console.debug, - info: log.info === console.info - } - - id: evaluate-tests - name: Evaluate test outputs - env: - RDMODE: ${{ runner.debug == '1' }} - run: | - # tests table, pipe separated: label | output | expected - # leading and trailing spaces on any field are trimmed - tests=$(cat << 'TESTS' - Validating debug default |\ - ${{ steps.debug-default.outputs.result }} |\ - {"runnerDebugMode":${{ env.RDMODE }},"debug":${{ env.RDMODE }},"info":${{ env.RDMODE }}} - Validating debug set to true |\ - ${{ steps.debug-true.outputs.result }} |\ - {"runnerDebugMode":${{ env.RDMODE }},"debug":true,"info":true} - Validating debug set to false |\ - ${{ steps.debug-false.outputs.result }} |\ - {"runnerDebugMode":${{ env.RDMODE }},"debug":false,"info":false} - TESTS - ) - - strim() { shopt -s extglob; lt="${1##+( )}"; echo "${lt%%+( )}"; } - while IFS='|' read label output expected; do - label="$(strim "$label")"; output="$(strim "$output")"; expected="$(strim "$expected")" - echo -n "- $label:" - if [[ "$output" != "$expected" ]]; then - echo $'\n::error::\u274C' "Expected '$expected', got '$output'" - exit 1 - fi - echo $' \u2705' - done <<< "$tests" - - echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY - - test-base-url: - name: 'Integration test: base-url option' - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./.github/actions/install-dependencies - - - id: base-url-default - name: API URL with base-url not set - uses: ./ - with: - script: | - const endpoint = github.request.endpoint - return endpoint({}).url - result-encoding: string - - - id: base-url-default-graphql - name: GraphQL URL with base-url not set - uses: ./ - with: - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).url - result-encoding: string - - - id: base-url-set - name: API URL with base-url set - uses: ./ - with: - base-url: https://my.github-enterprise-server.com/api/v3 - script: | - const endpoint = github.request.endpoint - return endpoint({}).url - result-encoding: string - - - id: base-url-set-graphql - name: GraphQL URL with base-url set - uses: ./ - with: - base-url: https://my.github-enterprise-server.com/api/v3 - script: | - const endpoint = github.request.endpoint - return endpoint({url: "/graphql"}).url - result-encoding: string - - - run: | - echo "- Validating API URL default" - expected="https://api.github.com/" - actual="${{steps.base-url-default.outputs.result}}" - if [[ "$expected" != "$actual" ]]; then - echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" - exit 1 - fi - echo "- Validating GraphQL URL default" - expected="https://api.github.com/graphql" - actual="${{steps.base-url-default-graphql.outputs.result}}" - if [[ "$expected" != "$actual" ]]; then - echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" - exit 1 - fi - echo "- Validating base-url set to a value" - expected="https://my.github-enterprise-server.com/api/v3/" - actual="${{steps.base-url-set.outputs.result}}" - if [[ "$expected" != "$actual" ]]; then - echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" - exit 1 - fi - echo "- Validating GraphQL URL with base-url set to a value" - expected="https://my.github-enterprise-server.com/api/v3/graphql" - actual="${{steps.base-url-set-graphql.outputs.result}}" - if [[ "$expected" != "$actual" ]]; then - echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual" - exit 1 - fi diff --git a/.github/workflows/licensed.yml.back b/.github/workflows/licensed.yml.back deleted file mode 100644 index 469021053..000000000 --- a/.github/workflows/licensed.yml.back +++ /dev/null @@ -1,24 +0,0 @@ -name: Licensed - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test: - runs-on: ubuntu-latest - name: Check licenses - steps: - - uses: meta-introspector/checkout@v3 - with: - fetch-depth: 0 # prefer to use a full fetch for licensed workflows - # https://github.com/meta-introspector/setup-licensed/releases/tag/v1.1.1 - - uses: meta-introspector/setup-licensed@82c5f4d19e8968efa74a25b132922382c2671fe2 - with: - version: '3.x' - - uses: ./.github/actions/install-dependencies - - run: licensed status diff --git a/.github/workflows/licensed.yml.back.back b/.github/workflows/licensed.yml.back.back deleted file mode 100644 index 6452d27f1..000000000 --- a/.github/workflows/licensed.yml.back.back +++ /dev/null @@ -1,24 +0,0 @@ -name: Licensed - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test: - runs-on: ubuntu-latest - name: Check licenses - steps: - - uses: meta-introspector/checkout@v3 - with: - fetch-depth: 0 # prefer to use a full fetch for licensed workflows - # https://github.com/jonabc/setup-licensed/releases/tag/v1.1.1 - - uses: jonabc/setup-licensed@82c5f4d19e8968efa74a25b132922382c2671fe2 - with: - version: '3.x' - - uses: ./.github/actions/install-dependencies - - run: licensed status diff --git a/.github/workflows/pull-request-test.yml.back b/.github/workflows/pull-request-test.yml.back deleted file mode 100644 index f105c6ae8..000000000 --- a/.github/workflows/pull-request-test.yml.back +++ /dev/null @@ -1,45 +0,0 @@ -name: Pull Request Test - -on: - pull_request: - branches: [main] - types: [opened, synchronize] - -jobs: - pull-request-test: - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./ - with: - script: | - // Get the existing comments. - const {data: comments} = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.number, - }) - - // Find any comment already made by the bot. - const botComment = comments.find(comment => comment.user.id === 41898282) - const commentBody = "Hello from meta-introspector/github-script! (${{ github.sha }})" - - if (context.payload.pull_request.head.repo.full_name !== 'meta-introspector/github-script') { - console.log('Not attempting to write comment on PR from fork'); - } else { - if (botComment) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: botComment.id, - body: commentBody - }) - } else { - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.number, - body: commentBody - }) - } - } diff --git a/.github/workflows/pull-request-test.yml.back.back b/.github/workflows/pull-request-test.yml.back.back deleted file mode 100644 index 6a0a73ed0..000000000 --- a/.github/workflows/pull-request-test.yml.back.back +++ /dev/null @@ -1,45 +0,0 @@ -name: Pull Request Test - -on: - pull_request: - branches: [main] - types: [opened, synchronize] - -jobs: - pull-request-test: - runs-on: ubuntu-latest - steps: - - uses: meta-introspector/checkout@v3 - - uses: ./ - with: - script: | - // Get the existing comments. - const {data: comments} = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.number, - }) - - // Find any comment already made by the bot. - const botComment = comments.find(comment => comment.user.id === 41898282) - const commentBody = "Hello from actions/github-script! (${{ github.sha }})" - - if (context.payload.pull_request.head.repo.full_name !== 'actions/github-script') { - console.log('Not attempting to write comment on PR from fork'); - } else { - if (botComment) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: botComment.id, - body: commentBody - }) - } else { - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.number, - body: commentBody - }) - } - }