Skip to content

Commit 885f3cf

Browse files
authored
Merge pull request #669 from github/enterprise-3.8.4-backport-665-timreimherr/actions-46-multi-repo-token-scope
Backport 665 for 3.8.4: Implement App Token
2 parents a2b9992 + bed2a4e commit 885f3cf

File tree

2 files changed

+37
-41
lines changed

2 files changed

+37
-41
lines changed

.github/workflows/build-and-release.yml

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ name: Build and Release
44
on:
55
workflow_dispatch:
66
inputs:
7-
gh-token:
8-
description: 'GitHub Token - used to create a commit in the backup-utils repo'
9-
required: true
10-
type: string
117
version:
128
description: 'Version - patch version of the release (e.g. x.y.z)'
139
required: true
@@ -21,22 +17,20 @@ on:
2117
jobs:
2218
build:
2319
runs-on: ubuntu-latest
20+
outputs:
21+
rc-app-token: ${{ steps.app-token.outputs.token }}
2422
steps:
25-
# resulting token still gets denied by the backup-utils repo
26-
# see: https://github.com/actions/create-github-app-token/pull/46
27-
# - uses: timreimherr/create-github-app-token@main
28-
# id: app-token
29-
# with:
30-
# # required
31-
# app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
32-
# private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
33-
# owner: ${{ github.repository_owner }}
34-
# repositories: backup-utils,backup-utils-private
23+
- uses: actions/create-github-app-token@v1
24+
id: app-token
25+
with:
26+
app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
27+
private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
28+
owner: ${{ github.repository_owner }}
29+
repositories: "backup-utils-private"
3530
- name: Checkout backup-utils-private
3631
uses: actions/checkout@v4
3732
with:
38-
token: ${{ github.event.inputs.gh-token }}
39-
repository: github/backup-utils-private
33+
token: ${{ steps.app-token.outputs.token }}
4034
- name: Install dependencies
4135
run: |
4236
sudo apt-get update -y
@@ -79,35 +73,40 @@ jobs:
7973
outputs:
8074
commit_hash: ${{ steps.empty-commit.outputs.commit_hash }}
8175
steps:
82-
# resulting token still gets denied by the backup-utils repo
83-
# see: https://github.com/actions/create-github-app-token/pull/46
84-
# - uses: timreimherr/create-github-app-token@main
85-
# id: app-token
86-
# with:
87-
# app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
88-
# private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
89-
# owner: ${{ github.repository_owner }}
90-
# repositories: backup-utils,backup-utils-private
76+
- uses: actions/create-github-app-token@v1
77+
id: app-token
78+
with:
79+
app-id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
80+
private-key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
81+
owner: ${{ github.repository_owner }}
82+
repositories: "backup-utils,backup-utils-private"
83+
- name: Get major-feature from version
84+
id: get-major-feature
85+
run: |
86+
echo "MAJOR_FEATURE=$(echo ${{ github.event.inputs.version }} | cut -d '.' -f 1,2)" >> "$GITHUB_ENV"
87+
- name: Verify major-feature
88+
run: |
89+
echo "major_feature: $MAJOR_FEATURE"
9190
- name: Checkout backup-utils
9291
uses: actions/checkout@v4
9392
with:
94-
token: ${{ github.event.inputs.gh-token }}
93+
token: ${{ steps.app-token.outputs.token }}
9594
repository: github/backup-utils
96-
ref: master
9795
- name: Create empty commit
9896
uses: stefanzweifel/git-auto-commit-action@v4
9997
id: empty-commit
10098
with:
101-
branch: master
99+
branch: ${{ env.MAJOR_FEATURE }}-stable
102100
commit_message: "${{ github.event.inputs.version }} release"
103-
commit_user_name: "${{ github.actor }}"
104-
commit_user_email: "ghes-releases-team@github.com"
101+
commit_user_name: "release-controller[bot]"
102+
commit_user_email: "223695+release-controller[bot]@users.noreply.github.com"
105103
commit_options: "--allow-empty"
104+
push_options: "--force"
106105
skip_dirty_check: true
107-
- name: Checkout backup-utils
106+
- name: Checkout backup-utils-private for release notes
108107
uses: actions/checkout@v4
109108
with:
110-
token: ${{ github.event.inputs.gh-token }}
109+
token: ${{ steps.app-token.outputs.token }}
111110
repository: github/backup-utils-private
112111
- name: Download deb artifact
113112
uses: actions/download-artifact@v3
@@ -120,20 +119,17 @@ jobs:
120119
- name: Create Release
121120
uses: ncipollo/release-action@v1
122121
with:
123-
token: ${{ github.event.inputs.gh-token }}
122+
token: ${{ steps.app-token.outputs.token }}
123+
owner: github
124124
repo: backup-utils
125125
name: |
126126
GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
127127
artifacts: |
128-
github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
128+
github-backup-utils-v${{ github.event.inputs.version }}.tar.gz,
129129
github-backup-utils_${{ github.event.inputs.version }}_all.deb
130130
tag: v${{ github.event.inputs.version }}
131-
commit: ${{ steps.empty-commit.outputs.commit_hash }}
131+
commit: ${{ env.MAJOR_FEATURE }}-stable
132132
bodyFile: release-notes/${{ github.event.inputs.version }}.md
133133
draft: ${{ github.event.inputs.draft }}
134134
allowUpdates: true
135-
artifactContentType: "raw"
136-
137-
138-
139-
135+
artifactContentType: "raw"

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# Full git history is needed to get a proper list of changed files within `super-linter`
1919
fetch-depth: 0
2020
- name: Lint Code Base
21-
uses: github/super-linter@v4
21+
uses: github/super-linter@v5
2222
env:
2323
VALIDATE_ALL_CODEBASE: false
2424
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)