Skip to content

Commit

Permalink
Gh-39: Update Gaffer workflow should automatically create issue (#48)
Browse files Browse the repository at this point in the history
* Use Admin token and create PR with issue number

* Update link issue action version
  • Loading branch information
GCHQDeveloper314 authored May 16, 2024
1 parent 3cf1d65 commit 54f2461
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/link-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
issue-links:
runs-on: ubuntu-latest
steps:
- uses: tkt-actions/add-issue-links@v1.6.0
- uses: tkt-actions/add-issue-links@v1.8.2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
branch-prefix: 'gh-'
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/update-gaffer-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ on:
description: 'Gaffer Version'
required: true

permissions:
pull-requests: write
contents: write
env:
GH_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}

jobs:
update-gaffer-version:
Expand All @@ -18,10 +17,10 @@ jobs:

steps:
- name: Checkout base branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '8'
Expand Down Expand Up @@ -49,13 +48,22 @@ jobs:
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Create Issue
id: create-issue
run: |
gh issue create --title "Update Gaffer version to ${{ github.event.inputs.version }}" --body "Use Gaffer version ${{ github.event.inputs.version }}" --label enhancement \
| sed -zE "s|.*/issues/([0-9]+)|ISSUE_ID=\1|" >> "$GITHUB_OUTPUT"
- name: Create PR branch
env:
VERSION_UPDATE_BRANCH: gh-${{ steps.create-issue.outputs.ISSUE_ID }}-updating-gaffer-version-${{ github.event.inputs.version }}
run: |
git checkout -b ${{ env.VERSION_UPDATE_BRANCH }}
git commit -am "Updated Gaffer version to ${{ github.event.inputs.version }}"
git push --set-upstream origin ${{ env.VERSION_UPDATE_BRANCH }}
- name: Submit PR
run: gh pr create --fill --head ${{ env.VERSION_UPDATE_BRANCH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_ID: ${{ steps.create-issue.outputs.ISSUE_ID }}
run: |-
gh pr create --title "Gh-$ISSUE_ID: Updated Gaffer version to ${{ github.event.inputs.version }}" --body ""

0 comments on commit 54f2461

Please sign in to comment.