diff --git a/.github/actions/dispatch-resume-workflow/.eslintrc.js b/.github/actions/dispatch-resume-workflow/.eslintrc.js index d2aeddc52..9bcfe4b68 100644 --- a/.github/actions/dispatch-resume-workflow/.eslintrc.js +++ b/.github/actions/dispatch-resume-workflow/.eslintrc.js @@ -32,6 +32,6 @@ module.exports = { '@typescript-eslint/quotes': ['error', 'single'], 'comma-spacing': 'off', - '@typescript-eslint/comma-spacing': ['error'] + '@typescript-eslint/comma-spacing': ['error'] } }; diff --git a/.github/actions/dispatch-resume-workflow/README.md b/.github/actions/dispatch-resume-workflow/README.md index 07af98daa..1132e645e 100644 --- a/.github/actions/dispatch-resume-workflow/README.md +++ b/.github/actions/dispatch-resume-workflow/README.md @@ -23,7 +23,7 @@ For details of the `workflow_dispatch` even see [this blog post introducing this > **Required.** A GitHub access token (PAT) with write access to the repo in question. > -> **NOTE.** The automatically provided token e.g. `${{ secrets.GITHUB_TOKEN }}` can not be used, GitHub prevents this token from being able to fire the `workflow_dispatch` and `repository_dispatch` event.[The reasons are explained in the docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token). +> **NOTE.** The automatically provided token e.g. `${{ secrets.GITHUB_TOKEN }}` can not be used, GitHub prevents this token from being able to fire the `workflow_dispatch` and `repository_dispatch` event.[The reasons are explained in the docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token). > The solution is to manually create a PAT and store it as a secret e.g. `${{ secrets.PERSONAL_TOKEN }}` ### `inputs` @@ -99,35 +99,35 @@ For details of the `workflow_dispatch` even see [this blog post introducing this > The result of the triggered workflow. May be one of `success`, `failure`, `cancelled`, `timed_out`, `skipped`, `neutral`, `action_required`. The step in your workflow will fail if the triggered workflow completes with `failure`, `cancelled` or `timed_out`. Other workflow conlusion are considered success. > Only available if `wait-for-completion` is `true` -### `workflow-logs` +### `output.workflow-logs` > The logs of the triggered workflow based if `inputs.workflow-logs` is set to either `output`, or `json-output`. > Based on the value, result will be: > > * `output`: Multiline string > - > ```log -> | -> | + > log +> job-name | datetime message +> job-name | datetime message > ... -> ``` +> > > * `json-output`: JSON string > - > ```json + > json > { -> "": [ +> "job-name": [ > { -> "datetime": "", -> "message": "" +> "datetime": "datetime", +> "message": "message" > }, > { -> "datetime": "", -> "message": "" +> "datetime": "datetime", +> "message": "message" > } > ] > } -> ``` +> ## Example usage diff --git a/.github/actions/dispatch-resume-workflow/dist/index.js b/.github/actions/dispatch-resume-workflow/dist/index.js index 7a8e9ec54..13cb12476 100644 --- a/.github/actions/dispatch-resume-workflow/dist/index.js +++ b/.github/actions/dispatch-resume-workflow/dist/index.js @@ -556,8 +556,8 @@ class OidcClient { const res = yield httpclient .getJson(id_token_url) .catch(error => { - throw new Error(`Failed to get ID Token. \n - Error Code : ${error.statusCode}\n + throw new Error(`Failed to get ID Token. \n + Error Code : ${error.statusCode}\n Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; @@ -31817,7 +31817,7 @@ module.exports = parseParams /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; -/******/ +/******/ /******/ // The require function /******/ function __nccwpck_require__(moduleId) { /******/ // Check if module is in cache @@ -31831,7 +31831,7 @@ module.exports = parseParams /******/ // no module.loaded needed /******/ exports: {} /******/ }; -/******/ +/******/ /******/ // Execute the module function /******/ var threw = true; /******/ try { @@ -31840,23 +31840,23 @@ module.exports = parseParams /******/ } finally { /******/ if(threw) delete __webpack_module_cache__[moduleId]; /******/ } -/******/ +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } -/******/ +/******/ /************************************************************************/ /******/ /* webpack/runtime/compat */ -/******/ +/******/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ +/******/ /************************************************************************/ -/******/ +/******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined /******/ var __webpack_exports__ = __nccwpck_require__(399); /******/ module.exports = __webpack_exports__; -/******/ +/******/ /******/ })() -; \ No newline at end of file +; diff --git a/.github/actions/dispatch-resume-workflow/tsconfig.json b/.github/actions/dispatch-resume-workflow/tsconfig.json index bc1eab06c..12aa0b584 100644 --- a/.github/actions/dispatch-resume-workflow/tsconfig.json +++ b/.github/actions/dispatch-resume-workflow/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "target": "es6", + "module": "commonjs", + "rootDir": "./src", + "strict": true, + "noImplicitAny": true, + "esModuleInterop": true }, "exclude": ["node_modules", "**/*.test.ts"] } diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 997061644..f42cd1980 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -81,6 +81,14 @@ updates: catch-all: patterns: - "*" + - package-ecosystem: "github-actions" + directory: "/.github/actions/dispatch-resume-workflow" + schedule: + interval: "weekly" + groups: + catch-all: + patterns: + - "*" - package-ecosystem: "github-actions" directory: "/.github/actions/docker-build-image" schedule: @@ -633,12 +641,3 @@ updates: catch-all: patterns: - "*" - - - package-ecosystem: "github-actions" - directory: "/.github/actions/dispatch-resume-workflow" - schedule: - interval: "weekly" - groups: - catch-all: - patterns: - - "*" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3832d3a68..9926a8891 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,9 @@ repos: args: ['--fix=lf'] exclude: .github/actions/send-slack-notification/tests/sample-commit-message.txt - id: end-of-file-fixer + exclude: '.github/actions/dispatch-resume-workflow/dist/*' - id: trailing-whitespace + exclude: .github/actions/dispatch-resume-workflow/dist/* - repo: https://github.com/sirosen/check-jsonschema rev: 0.28.5 hooks: diff --git a/docs/README.md b/docs/README.md index a3f5db464..46a4a8533 100644 --- a/docs/README.md +++ b/docs/README.md @@ -104,6 +104,7 @@ Here follows the list of GitHub Actions topics available in the current document - [update-project-base-tag](#update-project-base-tag) - [validate-maven-versions](#validate-maven-versions) - [veracode](#veracode) + - [dispatch-resume-workflow](#dispatch-resume-workflow) - [Reusable workflows provided by us](#reusable-workflows-provided-by-us) - [helm-publish-new-package-version.yml](#helm-publish-new-package-versionyml) - [terraform](#terraform) @@ -1691,6 +1692,17 @@ entry `release.baseTag.$PROJECT` with the value specified in the input `tag`. tag: ${{ env.ALPHA_VERSION }} ``` +### dispatch-resume-workflow + +Ability to dispatch or resume an existing workflow and wait for its completition + +```yaml + - uses: Alfresco/alfresco-build-tools/.github/actions/dispatch-resume-workflow@ref + with: + workflow: workflow-name.yml + run-id: existing_run_number (optional) +``` + ### validate-maven-versions Validates Maven dependency graph versions to ensure all target includes artifacts versions align