From 334347281ca27e21f91d57e71f71720c8d7b56a1 Mon Sep 17 00:00:00 2001 From: sylhare Date: Tue, 7 Dec 2021 14:13:16 -0500 Subject: [PATCH 1/5] Add workflows --- .github/workflows/add-issue-to-project.yml | 18 +++++ .github/workflows/add-label-to-review.yml | 17 ++++ .github/workflows/add-pr-to-project.yml | 27 +++++++ .github/workflows/ruby.yml | 16 ---- .github/workflows/view-context.yml | 20 +++++ .gitignore | 94 ++++++++++++++++++++++ 6 files changed, 176 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/add-issue-to-project.yml create mode 100644 .github/workflows/add-label-to-review.yml create mode 100644 .github/workflows/add-pr-to-project.yml create mode 100644 .github/workflows/view-context.yml diff --git a/.github/workflows/add-issue-to-project.yml b/.github/workflows/add-issue-to-project.yml new file mode 100644 index 0000000..c47081e --- /dev/null +++ b/.github/workflows/add-issue-to-project.yml @@ -0,0 +1,18 @@ +on: + issues: + types: [opened] + +jobs: + apply-label: + runs-on: ubuntu-latest + steps: + - name: Add issue to project board + uses: actions/github-script@v5 + continue-on-error: true + with: + script: | + github.rest.projects.createCard({ + column_id: 17134543, + content_id: context.payload.issue.id, + content_type: "Issue" + }); diff --git a/.github/workflows/add-label-to-review.yml b/.github/workflows/add-label-to-review.yml new file mode 100644 index 0000000..902dcc4 --- /dev/null +++ b/.github/workflows/add-label-to-review.yml @@ -0,0 +1,17 @@ +on: + pull_request: + types: [review_requested] + +jobs: + apply-label: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v5 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['Review'] + }) diff --git a/.github/workflows/add-pr-to-project.yml b/.github/workflows/add-pr-to-project.yml new file mode 100644 index 0000000..679c069 --- /dev/null +++ b/.github/workflows/add-pr-to-project.yml @@ -0,0 +1,27 @@ +# GitHub-script action https://github.com/actions/github-script +# GitHub context https://docs.github.com/en/actions/learn-github-actions/contexts#github-context + +name: '[Automation] Add PR to project' + +on: + pull_request: + types: [opened] + +jobs: + add-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Add PR to project board + uses: actions/github-script@v5 + continue-on-error: true + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.projects.createCard({ + column_id: 17134543, # IN_PROGRESS column + content_id: context.payload.pull_request.id, + content_type: "PullRequest" + }); diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 90216d7..aac208b 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -1,13 +1,3 @@ - - - - - - - - - - # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support @@ -45,9 +35,3 @@ jobs: run: gem install type-on-strap jekyll-theme-type-on-strap #- name: Run tests # run: bundle exec rake - - - - - - diff --git a/.github/workflows/view-context.yml b/.github/workflows/view-context.yml new file mode 100644 index 0000000..3e3cce9 --- /dev/null +++ b/.github/workflows/view-context.yml @@ -0,0 +1,20 @@ +name: 'Context' + +on: + push: + pull_request: + issues: + project: + workflow_call: + workflow_dispatch: + + +jobs: + create-card: + runs-on: ubuntu-latest + steps: + - name: View context attributes + continue-on-error: true + uses: actions/github-script@v5 + with: + script: console.log(context) diff --git a/.gitignore b/.gitignore index 210ed3c..4cc7d8e 100644 --- a/.gitignore +++ b/.gitignore @@ -103,3 +103,97 @@ dist # TernJS port file .tern-port .idea/* + + +Skip to content +Pull requests +Issues +Marketplace +Explore +@sylhare +sylhare / +Vermelinho +Public + +1 +0 + + 0 + +Code +Issues +Pull requests +Actions +Projects +Wiki +Security +Insights + + Settings + +Vermelinho/.gitignore +@sylhare +sylhare Add basic gem +Latest commit 44db84a on Jul 15 +History +1 contributor +58 lines (49 sloc) 1.19 KB +.idea/ +*.gem +*.iml +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# Used by dotenv library to load environment variables. +# .env + +# Ignore Byebug command history file. +.byebug_history + +## Specific to RubyMotion: +.dat* +.repl_history +build/ +*.bridgesupport +build-iPhoneOS/ +build-iPhoneSimulator/ + +## Specific to RubyMotion (use of CocoaPods): +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# vendor/Pods/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc + +# Used by RuboCop. Remote config files pulled in from inherit_from directive. +# .rubocop-https?--* +Loading complete From f542b53b8fdf57a55f55d193d13e12c4776e2b76 Mon Sep 17 00:00:00 2001 From: sylhare Date: Tue, 7 Dec 2021 14:23:42 -0500 Subject: [PATCH 2/5] Update workflows --- .github/workflows/add-issue-to-project.yml | 3 ++- .github/workflows/add-label-to-review.yml | 1 + .github/workflows/add-pr-to-project.yml | 16 +++++++++++----- .github/workflows/view-context.yml | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/add-issue-to-project.yml b/.github/workflows/add-issue-to-project.yml index c47081e..1e0c051 100644 --- a/.github/workflows/add-issue-to-project.yml +++ b/.github/workflows/add-issue-to-project.yml @@ -3,13 +3,14 @@ on: types: [opened] jobs: - apply-label: + cresate-issue-card: runs-on: ubuntu-latest steps: - name: Add issue to project board uses: actions/github-script@v5 continue-on-error: true with: + github-token: ${{secrets.ADMIN_PAT}} script: | github.rest.projects.createCard({ column_id: 17134543, diff --git a/.github/workflows/add-label-to-review.yml b/.github/workflows/add-label-to-review.yml index 902dcc4..78dbf1f 100644 --- a/.github/workflows/add-label-to-review.yml +++ b/.github/workflows/add-label-to-review.yml @@ -1,4 +1,5 @@ on: + pull_request_review: pull_request: types: [review_requested] diff --git a/.github/workflows/add-pr-to-project.yml b/.github/workflows/add-pr-to-project.yml index 679c069..30b5610 100644 --- a/.github/workflows/add-pr-to-project.yml +++ b/.github/workflows/add-pr-to-project.yml @@ -1,14 +1,11 @@ # GitHub-script action https://github.com/actions/github-script # GitHub context https://docs.github.com/en/actions/learn-github-actions/contexts#github-context - -name: '[Automation] Add PR to project' - on: pull_request: types: [opened] jobs: - add-pr: + create-pr-card: runs-on: ubuntu-latest steps: - name: Checkout repo @@ -18,10 +15,19 @@ jobs: uses: actions/github-script@v5 continue-on-error: true with: - github-token: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.ADMIN_PAT}} script: | github.rest.projects.createCard({ column_id: 17134543, # IN_PROGRESS column content_id: context.payload.pull_request.id, content_type: "PullRequest" }); + + - name: Add PR to project board + continue-on-error: true + run: | + curl -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -u ${{github.actor}}:${{secrets.ADMIN_PAT}} \ + -d '{"content_id": context.payload.pull_request.id, "content_type": "PullRequest", "column_id": 17134543 }' \ + https://api.github.com/projects/columns/17134543/cards diff --git a/.github/workflows/view-context.yml b/.github/workflows/view-context.yml index 3e3cce9..27e78e2 100644 --- a/.github/workflows/view-context.yml +++ b/.github/workflows/view-context.yml @@ -10,7 +10,7 @@ on: jobs: - create-card: + view-context: runs-on: ubuntu-latest steps: - name: View context attributes From 06aaec8ace1a01d8aa78c0757a132cb133a8bd48 Mon Sep 17 00:00:00 2001 From: sylhare Date: Tue, 7 Dec 2021 14:31:27 -0500 Subject: [PATCH 3/5] Update workflow --- .github/workflows/add-issue-to-project.yml | 3 ++- .github/workflows/add-label-to-review.yml | 3 +++ .github/workflows/add-pr-to-project.yml | 5 +++-- .github/workflows/view-context.yml | 9 --------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/add-issue-to-project.yml b/.github/workflows/add-issue-to-project.yml index 1e0c051..b848e20 100644 --- a/.github/workflows/add-issue-to-project.yml +++ b/.github/workflows/add-issue-to-project.yml @@ -1,3 +1,4 @@ +name: '[Automation]' on: issues: types: [opened] @@ -10,7 +11,7 @@ jobs: uses: actions/github-script@v5 continue-on-error: true with: - github-token: ${{secrets.ADMIN_PAT}} + github-token: ${{ secrets.ADMIN_PAT }} script: | github.rest.projects.createCard({ column_id: 17134543, diff --git a/.github/workflows/add-label-to-review.yml b/.github/workflows/add-label-to-review.yml index 78dbf1f..7fd9ffb 100644 --- a/.github/workflows/add-label-to-review.yml +++ b/.github/workflows/add-label-to-review.yml @@ -1,5 +1,7 @@ +name: '[Automation]' on: pull_request_review: + types: [submitted] pull_request: types: [review_requested] @@ -9,6 +11,7 @@ jobs: steps: - uses: actions/github-script@v5 with: + github-token: ${{ secrets.ADMIN_PAT }} script: | github.rest.issues.addLabels({ issue_number: context.issue.number, diff --git a/.github/workflows/add-pr-to-project.yml b/.github/workflows/add-pr-to-project.yml index 30b5610..dd6402d 100644 --- a/.github/workflows/add-pr-to-project.yml +++ b/.github/workflows/add-pr-to-project.yml @@ -1,5 +1,6 @@ # GitHub-script action https://github.com/actions/github-script # GitHub context https://docs.github.com/en/actions/learn-github-actions/contexts#github-context +name: '[Automation]' on: pull_request: types: [opened] @@ -15,7 +16,7 @@ jobs: uses: actions/github-script@v5 continue-on-error: true with: - github-token: ${{secrets.ADMIN_PAT}} + github-token: ${{ secrets.ADMIN_PAT }} script: | github.rest.projects.createCard({ column_id: 17134543, # IN_PROGRESS column @@ -28,6 +29,6 @@ jobs: run: | curl -X POST \ -H "Accept: application/vnd.github.v3+json" \ - -u ${{github.actor}}:${{secrets.ADMIN_PAT}} \ + -u ${{ github.actor }}:${{ secrets.ADMIN_PAT }} \ -d '{"content_id": context.payload.pull_request.id, "content_type": "PullRequest", "column_id": 17134543 }' \ https://api.github.com/projects/columns/17134543/cards diff --git a/.github/workflows/view-context.yml b/.github/workflows/view-context.yml index 27e78e2..9c3c0e8 100644 --- a/.github/workflows/view-context.yml +++ b/.github/workflows/view-context.yml @@ -1,14 +1,5 @@ name: 'Context' -on: - push: - pull_request: - issues: - project: - workflow_call: - workflow_dispatch: - - jobs: view-context: runs-on: ubuntu-latest From bdd25a8cf6c413415c57d60f59d3258edf523287 Mon Sep 17 00:00:00 2001 From: sylhare Date: Tue, 7 Dec 2021 14:38:35 -0500 Subject: [PATCH 4/5] Update workflow --- .github/workflows/add-issue-to-project.yml | 2 +- .github/workflows/add-label-to-review.yml | 2 +- .github/workflows/add-pr-to-project.yml | 2 +- .github/workflows/view-context.yml | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/add-issue-to-project.yml b/.github/workflows/add-issue-to-project.yml index b848e20..1e76ecf 100644 --- a/.github/workflows/add-issue-to-project.yml +++ b/.github/workflows/add-issue-to-project.yml @@ -1,4 +1,4 @@ -name: '[Automation]' +name: '[Automation] Add issue to project' on: issues: types: [opened] diff --git a/.github/workflows/add-label-to-review.yml b/.github/workflows/add-label-to-review.yml index 7fd9ffb..efb5de9 100644 --- a/.github/workflows/add-label-to-review.yml +++ b/.github/workflows/add-label-to-review.yml @@ -1,4 +1,4 @@ -name: '[Automation]' +name: '[Automation] Add review label' on: pull_request_review: types: [submitted] diff --git a/.github/workflows/add-pr-to-project.yml b/.github/workflows/add-pr-to-project.yml index dd6402d..c10574e 100644 --- a/.github/workflows/add-pr-to-project.yml +++ b/.github/workflows/add-pr-to-project.yml @@ -1,6 +1,6 @@ # GitHub-script action https://github.com/actions/github-script # GitHub context https://docs.github.com/en/actions/learn-github-actions/contexts#github-context -name: '[Automation]' +name: '[Automation] Add PR to project' on: pull_request: types: [opened] diff --git a/.github/workflows/view-context.yml b/.github/workflows/view-context.yml index 9c3c0e8..8fc97f1 100644 --- a/.github/workflows/view-context.yml +++ b/.github/workflows/view-context.yml @@ -1,5 +1,15 @@ name: 'Context' +on: + push: + pull_request: + pull_request_review: + issues: + project: + workflow_call: + workflow_dispatch: + + jobs: view-context: runs-on: ubuntu-latest From 37201db21a5f227180047bddae1e4dce8f4a7f72 Mon Sep 17 00:00:00 2001 From: sylhare Date: Tue, 7 Dec 2021 14:55:38 -0500 Subject: [PATCH 5/5] Update workflows --- .github/workflows/add-label-to-review.yml | 3 ++- .github/workflows/add-pr-to-project.yml | 6 +++++- .github/workflows/view-context.yml | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/add-label-to-review.yml b/.github/workflows/add-label-to-review.yml index efb5de9..e6898cf 100644 --- a/.github/workflows/add-label-to-review.yml +++ b/.github/workflows/add-label-to-review.yml @@ -4,6 +4,7 @@ on: types: [submitted] pull_request: types: [review_requested] + pull_request_target: jobs: apply-label: @@ -11,7 +12,7 @@ jobs: steps: - uses: actions/github-script@v5 with: - github-token: ${{ secrets.ADMIN_PAT }} + github-token: ${{ secrets.ADMIN_PAT }} || ${{ secrets.GITHUB_TOKEN }} script: | github.rest.issues.addLabels({ issue_number: context.issue.number, diff --git a/.github/workflows/add-pr-to-project.yml b/.github/workflows/add-pr-to-project.yml index c10574e..f2a57a2 100644 --- a/.github/workflows/add-pr-to-project.yml +++ b/.github/workflows/add-pr-to-project.yml @@ -2,6 +2,7 @@ # GitHub context https://docs.github.com/en/actions/learn-github-actions/contexts#github-context name: '[Automation] Add PR to project' on: + pull_request_target: pull_request: types: [opened] @@ -26,9 +27,12 @@ jobs: - name: Add PR to project board continue-on-error: true + env: + USER: "${{ github.actor }}" + TOKEN: "${{ secrets.ADMIN_PAT }}" run: | curl -X POST \ -H "Accept: application/vnd.github.v3+json" \ - -u ${{ github.actor }}:${{ secrets.ADMIN_PAT }} \ + -u ${USER}:${TOKEN} \ -d '{"content_id": context.payload.pull_request.id, "content_type": "PullRequest", "column_id": 17134543 }' \ https://api.github.com/projects/columns/17134543/cards diff --git a/.github/workflows/view-context.yml b/.github/workflows/view-context.yml index 8fc97f1..7da2871 100644 --- a/.github/workflows/view-context.yml +++ b/.github/workflows/view-context.yml @@ -4,6 +4,7 @@ on: push: pull_request: pull_request_review: + pull_request_target: issues: project: workflow_call: @@ -19,3 +20,11 @@ jobs: uses: actions/github-script@v5 with: script: console.log(context) + - name: Check secret + shell: bash + env: # Or as an environment variable + SUPER_SECRET: ${{ secrets.SuperSecret }} + USER: ${{ github.actor }} + run: | + echo "Secret: $SUPER_SECRET" + echo "${USER}"