From 913bf9f4148e00c786befdffe27846bc8a09c51e Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Fri, 30 Aug 2024 07:54:49 -0300 Subject: [PATCH] Add issue labeler Signed-off-by: Marcos Candeia --- .github/workflows/issues.yaml | 18 ++++++++++++++++++ .github/workflows/release.yaml | 11 +++++++---- .github/workflows/releaser.yaml | 33 ++++++++------------------------- 3 files changed, 33 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/issues.yaml diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml new file mode 100644 index 000000000..9504b5705 --- /dev/null +++ b/.github/workflows/issues.yaml @@ -0,0 +1,18 @@ +name: Label issues +on: + issues: + types: + - reopened + - opened +jobs: + label_issues: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - run: gh issue edit "$NUMBER" --add-label "$LABELS" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + LABELS: triage \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 74c872444..c7e75e636 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,7 +6,11 @@ on: # yamllint disable-line rule:truthy push: tags: - "**" - + workflow_dispatch: # Allows manual dispatch with parameters + inputs: + tag_name: + description: "The tag to be published" + required: true permissions: write-all jobs: release: @@ -15,10 +19,9 @@ jobs: runs-on: "ubuntu-latest" steps: - - name: "Determine tag" - run: 'echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV' - - name: "Create release" + env: + RELEASE_TAG: ${{ github.event.inputs.tag_name || github.ref_name }} uses: "actions/github-script@v6" with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/releaser.yaml b/.github/workflows/releaser.yaml index c8e489f0a..e6052366c 100644 --- a/.github/workflows/releaser.yaml +++ b/.github/workflows/releaser.yaml @@ -149,28 +149,11 @@ jobs: run: | git tag ${{ steps.determine_version.outputs.new_version }} git push origin ${{ steps.determine_version.outputs.new_version }} - - name: "Create release" - if: steps.determine_version.outputs.new_version != '' - uses: "actions/github-script@v6" - env: - RELEASE_TAG: ${{ steps.determine_version.outputs.new_version }} - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - script: | - const tag = process.env.RELEASE_TAG; - try { - const response = await github.rest.repos.createRelease({ - draft: false, - generate_release_notes: true, - name: `Release ${tag}`, - owner: context.repo.owner, - prerelease: tag.includes("rc-") || tag.includes("preview") || tag.includes("beta") || tag.includes("alpha"), - repo: context.repo.repo, - tag_name: tag, - }); - - core.exportVariable('RELEASE_ID', response.data.id); - core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url); - } catch (error) { - core.setFailed(error.message); - } \ No newline at end of file + + - name: Trigger Release Workflow + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.everest-preview+json" \ + https://api.github.com/repos/${{ github.repository }}/actions/workflows/release.yaml/dispatches \ + -d '{"ref":"main", "inputs":{"tag_name":"${{ steps.determine_version.outputs.new_version }}"}}' \ No newline at end of file