{"id":21630541,"url":"https://github.com/belsrc/action-playground","last_synced_at":"2026-04-11T13:33:17.631Z","repository":{"id":48272670,"uuid":"214861529","full_name":"belsrc/action-playground","owner":"belsrc","description":null,"archived":false,"fork":false,"pushed_at":"2021-08-03T19:20:51.000Z","size":3408,"stargazers_count":3,"open_issues_count":18,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T21:28:40.360Z","etag":null,"topics":["actions","github","github-actions"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/belsrc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-13T17:17:38.000Z","updated_at":"2022-09-20T20:17:48.000Z","dependencies_parsed_at":"2022-08-24T14:38:29.098Z","dependency_job_id":null,"html_url":"https://github.com/belsrc/action-playground","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/belsrc/action-playground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belsrc%2Faction-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belsrc%2Faction-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belsrc%2Faction-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belsrc%2Faction-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/belsrc","download_url":"https://codeload.github.com/belsrc/action-playground/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belsrc%2Faction-playground/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31682953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","github","github-actions"],"created_at":"2024-11-25T02:11:23.205Z","updated_at":"2026-04-11T13:33:17.600Z","avatar_url":"https://github.com/belsrc.png","language":"JavaScript","readme":"# Play around with Github actions\n\n[![Build Status](https://github.com/belsrc/action-playground/workflows/build-check/badge.svg)](https://github.com/belsrc/action-playground/actions)\n\n#### General Safety Checks\n\n```yml\nname: build-check\n\non:\n  # trigger on PRs.\n  # `opened` is when the PR is opend\n  # `synchronize` is when any additional pushes are made to the PR\n  pull_request:\n    types: [opened, synchronize]\n\n  # trigger on branch push\n  # only trigger on pushes to the `master` and `develop` branches (this also means PR merges)\n  # we can also ignore them if they only contain documentation changes\n  push:\n    branches:\n      - master\n      - develop\n    paths-ignore:\n      - 'docs/**'\n      - '**.md'\n\njobs:\n  # If the job does NOT have any `needs` jobs, then they are ran in parallel\n  # Run ESLint over the code base\n  lint:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Git Checkout\n        uses: actions/checkout@v1\n\n      - name: Setup Node\n        uses: actions/setup-node@v1\n        with:\n          node-version: 10\n\n      - name: Install Packages\n        run: npm ci\n\n      - name: Run Linter\n        run: npm run lint\n\n  # Run all of the unit tests\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Git Checkout\n        uses: actions/checkout@v1\n\n      - name: Setup Node\n        uses: actions/setup-node@v1\n        with:\n          node-version: 10\n\n      - name: Install Packages\n        run: npm ci\n\n      - name: Run Unit Tests\n        run: npm run coverage\n\n  # If `lint` and `test` pass (this is the `needs` line)\n  # then check the actual compiling\n  build:\n    needs: [test, lint]\n    runs-on: ubuntu-latest\n    steps:\n      - name: Git Checkout\n        uses: actions/checkout@v1\n\n      - name: Setup Node\n        uses: actions/setup-node@v1\n        with:\n          node-version: 10\n\n      - name: Install Packages\n        run: npm ci\n\n      - name: Run Build\n        run: npm run build\n```\n\n#### Publish on New Tags\n\n```yml\nname: publish\n\n# Trigger the publish on tag pushes\n# You can also use\n#  release:\n#    types: [published]\n# But this requires you to make a new release from Github\non:\n  push:\n    tags:\n      - v*.*.*\n\njobs:\n  # Run ESLint over the code base\n  lint:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Git Checkout\n        uses: actions/checkout@v1\n\n      - name: Setup Node\n        uses: actions/setup-node@v1\n        with:\n          node-version: 10\n\n      - name: Install Packages\n        run: npm ci\n\n      - name: Run Linter\n        run: npm run lint\n\n  # Run all of the unit tests\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Git Checkout\n        uses: actions/checkout@v1\n\n      - name: Setup Node\n        uses: actions/setup-node@v1\n        with:\n          node-version: 10\n\n      - name: Install Packages\n        run: npm ci\n\n      - name: Run Unit Tests\n        run: npm run test:cov\n\n  # If `lint` and `test` pass, build and publish to Github Pkg Reg\n  publish-gpr:\n    needs: [test, lint]\n    runs-on: ubuntu-latest\n    steps:\n      - name: Git Checkout\n        uses: actions/checkout@v1\n\n      - name: Setup Node\n        uses: actions/setup-node@v1\n        with:\n          node-version: 10\n          registry-url: https://npm.pkg.github.com/\n          scope: '@belsrc'\n\n      - name: Install Packages\n        run: npm ci\n\n      - name: Run Build\n        run: npm run build\n\n      - name: Publish Package @ Github\n        run: npm publish\n        env:\n          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}\n\n      - name: Create Release\n        uses: softprops/action-gh-release@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n  # # Publish to NPM Pkg Reg\n  # publish-npm:\n  #   needs: [test, lint]\n  #   runs-on: ubuntu-latest\n  #   steps:\n  #     - name: Git Checkout\n  #       uses: actions/checkout@v1\n  #\n  #     - name: Setup Node\n  #       uses: actions/setup-node@v1\n  #       with:\n  #         node-version: 10\n  #         registry-url: https://npm.pkg.github.com/\n  #         scope: '@belsrc'\n  #\n  #     - name: Install Packages\n  #       run: npm ci\n  #\n  #     - name: Run Build\n  #       run: npm run build\n  #\n  #     - name: Publish Package @ NPM\n  #       run: npm publish\n  #       env:\n  #         NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}\n  #\n  #     - name: Create Release\n  #       uses: softprops/action-gh-release@v1\n  #       env:\n  #         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n#### Addition to Test Job for CodeCov Reports\n\n```yml\n- name: Upload coverage to Codecov\n  uses: codecov/codecov-action@v1.0.2\n  with:\n    token: ${{secrets.CODECOV_TOKEN}}\n```\n\n#### Addition to Test Job for CodeClimate coverage Reports\n\n```yml\n- name: Upload coverage to CodeClimate\n  run: |\n    export GIT_BRANCH=\"${GITHUB_REF/refs\\/heads\\//}\"\n    curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 \u003e ./cc-test-reporter\n    chmod +x ./cc-test-reporter\n    ./cc-test-reporter format-coverage -t lcov coverage/lcov.info\n    ./cc-test-reporter upload-coverage\n  env:\n    CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}\n```\n\n#### Yarn Use\n\nFor Yarn you will need to use an Action from the marketplace, Borales/actions-yarn.\n\n```yml\n- name: Install Packages\n  uses: Borales/actions-yarn@v2.0.1\n  with:\n    cmd: install\n\n- name: Run Linter\n  uses: Borales/actions-yarn@v2.0.1\n  with:\n    cmd: run lint\n```\n\nThough, admittedly, I've found it easier to just use npm for most of the actions.\n\n**Edit:** It's actually easier, with less odd behavior, to just use an explicit approach instead of the above Yarn action.\n\n```yml\nlint:\n  runs-on: ubuntu-latest\n  steps:\n    - name: Git Checkout\n      uses: actions/checkout@v1\n\n    - name: Setup Node\n      uses: actions/setup-node@v1\n      with:\n        node-version: 10\n\n    - name: Install Yarn\n      run: npm i -g yarn\n\n    - name: Install Packages\n      run: yarn install\n\n    - name: Run Linter\n      run: yarn run lint\n```\n\n#### Commiting Action changes\n\nIf you want to back commit any changes that occured in the actions (linting/prettier) you can use the `ad-m/github-push-action` action.\nIn order to use it on branches dynamically, you will also need to pull out the branch name from the ref.\nIt would probably also be a good idea to check to see if any files were actually modified in the previous step.\nThis will avoid the \"nothing to commit, working tree clean\" if you try to commit nothing.\nIf it doesn't need to be dynamic, you can remove the `Extract Branch Name` step and hard code the `branch` in the `Push Changes` step.\n\n[Example Commit](https://github.com/belsrc/action-playground/commit/0a7ac2ad1b9449f32704e508c0189255f71706a5)\n\n[Action Ouput With Change Files](https://github.com/belsrc/action-playground/commit/586edfe1eeeea2fa92ffacef86a35e7f033acfb6/checks?check_suite_id=328143331)\n\n[Action Output When Theres Nothing Changed](https://github.com/belsrc/action-playground/commit/ea8042bd61ee3c373a7e84157395711822958ad7/checks?check_suite_id=328154873)\n\n```yml\nclean:\n  runs-on: ubuntu-latest\n  steps:\n    - name: Git Checkout\n      uses: actions/checkout@v1\n\n    - name: Setup Node\n      uses: actions/setup-node@v1\n      with:\n        node-version: 10\n\n    - name: Install Packages\n      run: npm ci\n\n    - name: Run Prettier\n      run: npm run prettier\n\n    - name: Run Linter\n      run: npm run lint\n\n    - name: Extract Branch Name\n        shell: bash\n        run: |\n          echo ${GITHUB_REF#refs/heads/}\n          echo \"##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})\"\n        id: extract_branch\n\n    - name: Count Changed Files\n        shell: bash\n        run: |\n          git status -s -uno | wc -l\n          echo \"##[set-output name=count;]$(git status -s -uno | wc -l)\"\n        id: changed_count\n\n    - name: Commit Files\n      if: steps.changed_count.outputs.count \u003e 0\n      run: |\n        git config --local user.email \"action@github.com\"\n        git config --local user.name \"GitHub Action\"\n        git commit -m \"style: prettier \u0026 eslint changes\" -a --no-verify\n\n    - name: Push Changes\n      if: steps.changed_count.outputs.count \u003e 0\n      uses: ad-m/github-push-action@master\n      with:\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        branch: ${{ steps.extract_branch.outputs.branch }}\n```\n\n#### Azure Blob Deploy (Based on branch)\n\nAs there's not currently a specific action for Blob transfers, you'll need to use the azure/cli action. You'll need deployment credentials for the log in ([Noted here](https://github.com/Azure/login#configure-deployment-credentials) and addditional info [here](https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-github-actions). Can use the \"Try It\" shell there too)\n\n```yml\nenv:\n  ACCOUNT_NAME: \u003cstorage account name\u003e\n  SOURCE_DIR: dist/\n  DEST_DIR: \u003cpath/in/storage\u003e\n  # No trailing slash\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Git Checkout\n        uses: actions/checkout@v1\n\n      - name: Setup Node\n        uses: actions/setup-node@v1\n        with:\n          node-version: 10\n\n      - name: Install Packages\n        run: npm ci\n\n      - name: Run Build\n        run: npm run build\n\n      # Branch name so if can be used as a sub-directory\n      # Replace some annoying characters, for various reasons\n      - name: Extract Branch Name\n        shell: bash\n        run: |\n          echo ${GITHUB_REF#refs/heads/} | sed \"s/[\\.\\/\\\\:]/_/g\"\n          echo \"##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | sed \"s/[\\.\\/\\\\:]/_/g\")\"\n        id: extract_branch\n\n      - name: Azure Login\n        uses: azure/login@v1\n        with:\n          creds: ${{ secrets.AZURE_CREDENTIALS  }}\n\n      # Use the DEST_DIR + branch name to make complete path\n      - name: Azure CLI Copy Artifacts\n        uses: azure/CLI@v1\n        with:\n          azcliversion: latest\n          inlineScript: |\n            az storage blob upload-batch --account-name ${{ env.ACCOUNT_NAME }} -s ${{ env.SOURCE_DIR }} -d '${{ env.DEST_DIR }}/${{ steps.extract_branch.outputs.branch }}'\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelsrc%2Faction-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbelsrc%2Faction-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelsrc%2Faction-playground/lists"}