diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4961c4d..76eef83 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,17 +2,33 @@ name: CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: statics: name: Static checks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 with: persist-credentials: false - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.3 + - run: pipx run pre-commit run --all-files --show-diff-on-failure + + # ponytail: guard-path smoke test only (no token/network); add a real + # sync test against a scratch fork if the push logic ever changes. + smoke: + name: Action wiring smoke test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - name: Run without upstream_repository (expected to fail) + id: run + continue-on-error: true + uses: ./ + with: + github_token: dummy + upstream_repository: "" + - name: Assert the action failed on missing input + run: '[ "${{ steps.run.outcome }}" = "failure" ]' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 45eaa86..81ba5fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,16 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - - id: debug-statements - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.8.0.4 + rev: v0.11.0.1 hooks: - id: shellcheck - repo: https://github.com/thlorenz/doctoc.git - rev: v2.1.0 + rev: v2.5.0 hooks: - id: doctoc name: Add TOC for md files diff --git a/action.yml b/action.yml index dabddab..c4892d4 100644 --- a/action.yml +++ b/action.yml @@ -30,5 +30,15 @@ inputs: description: 'Determines if --tags is used' required: false runs: - using: 'node16' - main: 'start.js' + using: 'composite' + steps: + - run: "${GITHUB_ACTION_PATH}/start.sh" + shell: bash + env: + INPUT_GITHUB_TOKEN: ${{ inputs.github_token }} + INPUT_UPSTREAM_REPOSITORY: ${{ inputs.upstream_repository }} + INPUT_TARGET_REPOSITORY: ${{ inputs.target_repository }} + INPUT_UPSTREAM_BRANCH: ${{ inputs.upstream_branch }} + INPUT_TARGET_BRANCH: ${{ inputs.target_branch }} + INPUT_FORCE: ${{ inputs.force }} + INPUT_TAGS: ${{ inputs.tags }} diff --git a/start.js b/start.js deleted file mode 100644 index 6df08e4..0000000 --- a/start.js +++ /dev/null @@ -1,26 +0,0 @@ -const spawn = require('child_process').spawn; -const path = require("path"); - -const exec = (cmd, args=[]) => new Promise((resolve, reject) => { - console.log(`Started: ${cmd} ${args.join(" ")}`); - const app = spawn(cmd, args, { stdio: 'inherit' }); - app.on('close', code => { - if(code !== 0){ - err = new Error(`Invalid status code: ${code}`); - err.code = code; - return reject(err); - }; - return resolve(code); - }); - app.on('error', reject); -}); - -const main = async () => { - await exec('bash', [path.join(__dirname, './start.sh')]); -}; - -main().catch(err => { - console.error(err); - console.error(err.stack); - process.exit(err.code || -1); -});