Skip to content

Commit

Permalink
refactor(): use dropdown options action (#8)
Browse files Browse the repository at this point in the history
* Use `ShaMan123/gha-form-dropdown-options` to write options
* Update bug report workflow to use the local file to trigger the action
* fix semver undefined
* fix paginate github
* tests: extensive
  • Loading branch information
ShaMan123 authored Sep 27, 2022
1 parent 2e4e6d2 commit 605db79
Show file tree
Hide file tree
Showing 11 changed files with 388 additions and 4,071 deletions.
175 changes: 172 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,82 @@ body:
description: fabric npm
options:
- 5.2.4
- 5.2.4-browser
- 5.2.2
- 5.2.2-browser
- 5.2.1
- 5.2.1-browser
- 5.1.0
- 5.1.0-browser
- 5.0.0
- 5.0.0-browser
- 4.6.0
- 4.6.0-browser
- 4.5.1
- 4.5.1-browser
- 4.5.0
- 4.5.0-browser
- 4.4.0
- 4.4.0-browser
- 4.3.1
- 4.3.1-browser
- 4.3.0
- 4.3.0-browser
- 4.2.0
- 4.2.0-browser
- 4.1.0
- 4.1.0-browser
- 4.0.0
- 4.0.0-rc.1-browser
- 4.0.0-rc.1
- 4.0.0-browser
- 4.0.0-beta1
- 4.0.0-beta.9-browser
- 4.0.0-beta.8-browser
- 4.0.0-beta.7-browser
- 4.0.0-beta.6-browser
- 4.0.0-beta.5-browser
- 4.0.0-beta.4-browser
- 4.0.0-beta.12-browser
- 4.0.0-beta.11-browser
- 4.0.0-beta.10-browser
- 4.0.0-beta.12
- 4.0.0-beta.11
- 4.0.0-beta.10
- 4.0.0-beta.9
- 4.0.0-beta.8
- 4.0.0-beta.7
- 4.0.0-beta.6
- 4.0.0-beta.5
- 4.0.0-beta.4
- 4.0.0-beta.3
- 4.0.0-beta.2
- 3.6.6
- 3.6.6-browser
- 3.6.5
- 3.6.5-browser
- 3.6.4
- 3.6.4-browser
- 3.6.3
- 3.6.3-browser
- 3.6.2
- 3.6.2-browser
- 3.6.1
- 3.6.1-browser
- 3.6.0
- 3.6.0-browser
- 3.5.1
- 3.5.1-browser
- 3.5.0
- 3.5.0-browser
- 3.4.0
- 3.4.0-browser
- 3.3.2
- 3.3.2-browser
- 3.3.1
- 3.3.1-browser
- 3.3.0
- 3.3.0-browser
- 3.2.0
- 3.1.0
- 3.0.0
Expand All @@ -58,6 +108,7 @@ body:
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.2-b
- 2.4.1
- 2.4.0
- 2.3.6
Expand All @@ -77,6 +128,18 @@ body:
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0.0-rc.4
- 2.0.0-rc.3
- 2.0.0-rc.2
- 2.0.0-rc.1
- 2.0.0-beta0
- 2.0.0-beta.7
- 2.0.0-beta.6
- 2.0.0-beta.5
- 2.0.0-beta.4
- 2.0.0-beta.3
- 2.0.0-beta.2
- 2.0.0-beta.1
- 1.7.22
- 1.7.21
- 1.7.20
Expand Down Expand Up @@ -107,6 +170,7 @@ body:
- 1.6.2
- 1.6.1
- 1.6.0
- 1.6.0-rc.1
- 1.5.0
- 1.4.13
- 1.4.12
Expand Down Expand Up @@ -224,6 +288,12 @@ body:
options:
- v5.2.4
- v5.2.3
- v521
- v520
- v510
- v500
- v460
- v451
- v4.5.0
- v4.4.0
- v4.3.1
Expand All @@ -234,8 +304,106 @@ body:
- v3.6.5
- v3.6.4
- v4.0.0
- v4.0.0-rc.1
- v4.0.0-beta.12
- v4.0.0-beta.11
- v4.0.0-beta.10
- v4.0.0-beta.9
- v4.0.0-beta.8
- v363
- v3.6.3
- v4.0.0-beta.7
- v4.0.0-beta.6
- v3.6.2
- 4.0.0-beta.5
- v4.0.0-beta.4
- v4.0.0-beta.3
- v4.0.0-beta.2
- v4.0.0-beta.1
- v3.6.1
- v3.6.0
- v3.5.0
- v3.4.0
- 3.3.2
- v3.2.0
- v3.1.0
- v3.0.0
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.6
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- 2.4.2-b
- v2.4.1
- v2.4.0
- v2.3.6
- v2.3.5
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- 1.7.22
- v2.0.0-rc.4
- 1.7.21
- v2.0.0-rc.3
- v2.0.0-rc.2
- v2.0.0-rc.1
- v1.7.20
- v2.0.0-beta.7
- v1.7.19
- v1.7.18
- v2.0.0-beta.6
- v2.0.0-beta.4
- v1.7.17
- v1.7.16
- v2.0.0-beta.3
- v1.7.15
- v1.7.14
- v1.7.13
- v1.7.12
- v1.7.11
- v1.7.10
- v2.0.0-beta.1
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- 1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- 1.7.0
- v1.6.7
- v1.6.6
- v1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.13
- v1.4.12
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.0
validations:
required: true
- type: dropdown
Expand Down Expand Up @@ -322,6 +490,7 @@ body:
label: Using `outputs.tags` from a dry run
description: Axios npm
options:
- 1.0.0-alpha.1
- 0.27.2
- 0.27.1
- 0.27.0
Expand Down Expand Up @@ -351,11 +520,11 @@ body:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
validations:
required: false
- type: textarea
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/update_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,28 @@ jobs:
runs-on: ubuntu-latest
name: Update bug report
steps:
- uses: actions/checkout@v3
# used for testing this action
# needed to reference the local action
- name: 'TEST: Get branch for job'
id: branch
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
switch ('${{ github.event_name }}') {
case 'pull_request':
return '${{ github.head_ref }}';
case 'release':
return '${{ github.event.repository.default_branch }}';
default:
return '${{ github.ref }}';
}
# used for testing this action
- name: 'TEST: Checkout ${{ steps.branch.outputs.result }}'
uses: actions/checkout@v3
with:
ref: ${{ steps.branch.outputs.result }}
- name: Update fabric
id: fabric
uses: ./
Expand Down
44 changes: 17 additions & 27 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
github_token:
description: Github token
default: ${{ github.token }}
ref:
description: Github ref/branch to update, inferred from the event type if omitted
type: string
form:
description: 'The location of the yaml form file'
default: '.github/ISSUE_TEMPLATE/bug_report.yml'
Expand Down Expand Up @@ -61,39 +64,26 @@ outputs:
runs:
using: composite
steps:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
- run: echo "job_ref=${{ github.ref }}" >> $GITHUB_ENV
shell: bash
- run: echo "job_ref=${{ github.head_ref }}" >> $GITHUB_ENV
if: ${{ github.event_name == 'pull_request' }}
shell: bash
- run: echo "job_ref=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV
if: ${{ github.event_name == 'release' }}
shell: bash
- uses: actions/checkout@v3
with:
ref: ${{ env.job_ref }}
- name: Update ${{ inputs.form }}
- name: Fetch tags from ${{ inputs.registry }}:${{ inputs.package }}
id: main
run: node dist/main.cjs
if: ${{ !inputs.tags }}
run: |
echo "Fetching tags from ${{ inputs.registry }}:${{ inputs.package }}"
node ${{ github.action_path }}/dist/main.cjs
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
INPUT_FORM: ${{ inputs.form }}
INPUT_DROPDOWN: ${{ inputs.dropdown }}
INPUT_PACKAGE: ${{ inputs.package }}
INPUT_REGISTRY: ${{ inputs.registry }}
INPUT_ORDER: ${{ inputs.order }}
INPUT_LIMIT_TO: ${{ inputs.limit_to }}
INPUT_SEMVER: ${{ inputs.semver }}
INPUT_TAGS: ${{ inputs.tags }}
INPUT_COMMIT_MESSAGE: ${{ inputs.commit_message }}
- name: Commit to ${{ env.job_ref }}
if: ${{ !fromJSON(inputs.dry_run) }}
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add ${{ inputs.form }}
git diff --staged --quiet || git commit -m "${{ inputs.commit_message }}"
git push
shell: bash
- name: Set dropdown options
uses: ShaMan123/[email protected]
with:
ref: ${{ inputs.ref }}
form: ${{ inputs.form }}
dropdown: ${{ inputs.dropdown }}
options: ${{ inputs.tags || steps.main.outputs.tags }}
commit_message: ${{ inputs.commit_message }}
dry_run: ${{ inputs.dry_run }}
Loading

0 comments on commit 605db79

Please sign in to comment.