From c6d32c1e49ffa84e7725689346d81db35bc1e3b4 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Thu, 3 Jun 2021 22:31:08 +0530 Subject: Converted from travis builds to GH Actions --- .github/workflows/ferdi-builds.yml | 53 ++++++++++++++++++++++++++++ .github/workflows/first-time-contributor.yml | 40 +++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/ferdi-builds.yml create mode 100644 .github/workflows/first-time-contributor.yml (limited to '.github/workflows') diff --git a/.github/workflows/ferdi-builds.yml b/.github/workflows/ferdi-builds.yml new file mode 100644 index 0000000..ce6726a --- /dev/null +++ b/.github/workflows/ferdi-builds.yml @@ -0,0 +1,53 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +# Note: This workflow requires some secrets setup, and set on this repo with the names: + # 'FERDI_PUBLISH_TOKEN' (A GitHub Personal Access Token with appropriate permissions - for publishing the built artifacts) + # 'APPLEID' (The username of your Apple developer account - for notarizing the mac artifacts) + # 'APPLEID_PASSWORD' (An app-specific password - for notarizing the mac artifacts) + # 'CSC_LINK' (The HTTPS link or local path to certificate - for code signing of mac and windows artifacts) + # 'CSC_KEY_PASSWORD' (The password to decrypt the certificate given in CSC_LINK - for code signing of mac and windows artifacts) + +name: Ferdi Recipes Builds + +on: + # Push to any tracked branches + push: + branches: [master] + # PRs only on master branch + pull_request: + branches: [master] + # Manual trigger from the UI + workflow_dispatch: + inputs: + message: + description: 'Message for build' + required: true + +jobs: + build: + name: Ferdi Recipes Build + runs-on: ubuntu-latest + steps: + - name: Print latest commit + run: echo ${{ github.sha }} + - name: Set env vars + run: echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV + - name: Checkout code + uses: actions/checkout@v2 + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: ${{ env.NPM_CACHE }} + key: build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + build-${{ env.cache-name }}- + build- + - name: Use Node.js 14.16.1 + uses: actions/setup-node@v2 + with: + node-version: 14.16.1 + - name: Install node dependencies recursively + run: npm i && npm run package diff --git a/.github/workflows/first-time-contributor.yml b/.github/workflows/first-time-contributor.yml new file mode 100644 index 0000000..8b4467b --- /dev/null +++ b/.github/workflows/first-time-contributor.yml @@ -0,0 +1,40 @@ +# Copied from: https://awesomeopensource.com/project/actions/github-script?categoryPage=7 + +name: Welcome first time contributors + +on: pull_request + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + // Get a list of all issues created by the PR opener + // See: https://octokit.github.io/rest.js/#pagination + const creator = context.payload.sender.login + const opts = github.issues.listForRepo.endpoint.merge({ + ...context.issue, + creator, + state: 'all' + }) + const issues = await github.paginate(opts) + + for (const issue of issues) { + if (issue.number === context.issue.number) { + continue + } + + if (issue.pull_request) { + return // Creator is already a contributor. + } + } + + await github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Welcome, ${{ creator }}! Thanks for contributing to Ferdi!' + }) -- cgit v1.2.3-54-g00ecf