Skip to content

Commit 765260f

Browse files
committed
see token permissions
1 parent ddd2752 commit 765260f

File tree

1 file changed

+105
-102
lines changed

1 file changed

+105
-102
lines changed

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

Lines changed: 105 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -24,110 +24,113 @@ jobs:
2424
steps:
2525
# resulting token still gets denied by the backup-utils repo
2626
# 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
35-
- name: Checkout backup-utils-private
36-
uses: actions/checkout@v4
27+
- uses: timreimherr/create-github-app-token@main
28+
id: app-token
3729
with:
38-
token: ${{ github.event.inputs.gh-token }}
39-
repository: github/backup-utils-private
40-
- name: Install dependencies
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
35+
- name: Print app permissions
4136
run: |
42-
sudo apt-get update -y
43-
sudo apt-get install -y moreutils debhelper help2man devscripts gzip
44-
- name: Create tag # this is required for the build scripts
45-
run: |
46-
git config user.name "${{ github.actor }}"
47-
git config user.email "[email protected]"
48-
git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
49-
git push origin "v${{ github.event.inputs.version }}"
50-
- name: Package deb
51-
run: |
52-
./script/package-deb
53-
# many need to remove this once release-notes compilation is automated
54-
- name: Rename deb artifact
55-
run: |
56-
for file in dist/github-backup-utils_*_all.deb; do
57-
if [[ -f "$file" ]]; then
58-
mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
59-
fi
60-
done
61-
- name: Upload deb artifact
62-
uses: actions/upload-artifact@v3
63-
with:
64-
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
65-
path: |
66-
dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
67-
- name: Package tarball
68-
run: |
69-
./script/package-tarball
70-
- name: Upload tarball artifact
71-
uses: actions/upload-artifact@v3
72-
with:
73-
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
74-
path: |
75-
dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
76-
release:
77-
needs: build
78-
runs-on: ubuntu-latest
79-
outputs:
80-
commit_hash: ${{ steps.empty-commit.outputs.commit_hash }}
81-
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
91-
- name: Checkout backup-utils
92-
uses: actions/checkout@v4
93-
with:
94-
token: ${{ github.event.inputs.gh-token }}
95-
repository: github/backup-utils
96-
ref: master
97-
- name: Create empty commit
98-
uses: stefanzweifel/git-auto-commit-action@v4
99-
id: empty-commit
100-
with:
101-
branch: master
102-
commit_message: "${{ github.event.inputs.version }} release"
103-
commit_user_name: "${{ github.actor }}"
104-
commit_user_email: "[email protected]"
105-
commit_options: "--allow-empty"
106-
skip_dirty_check: true
107-
- name: Download deb artifact
108-
uses: actions/download-artifact@v3
109-
with:
110-
name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
111-
- name: Download tarball artifact
112-
uses: actions/download-artifact@v3
113-
with:
114-
name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
115-
- name: Create Release
116-
uses: ncipollo/release-action@v1
117-
with:
118-
token: ${{ github.event.inputs.gh-token }}
119-
repo: backup-utils
120-
name: |
121-
GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
122-
artifacts: |
123-
github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
124-
github-backup-utils_${{ github.event.inputs.version }}_all.deb
125-
tag: v${{ github.event.inputs.version }}
126-
commit: ${{ steps.empty-commit.outputs.commit_hash }}
127-
bodyFile: release-notes/${{ github.event.inputs.version }}.md
128-
draft: ${{ github.event.inputs.draft }}
129-
allowUpdates: true
130-
artifactContentType: "raw"
37+
curl -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/app/installations | jq '.[] | {permissions: .permissions, target_type: .target_type, repository_selection: .repository_selection}'
38+
# - name: Checkout backup-utils-private
39+
# uses: actions/checkout@v4
40+
# with:
41+
# token: ${{ github.event.inputs.gh-token }}
42+
# repository: github/backup-utils-private
43+
# - name: Install dependencies
44+
# run: |
45+
# sudo apt-get update -y
46+
# sudo apt-get install -y moreutils debhelper help2man devscripts gzip
47+
# - name: Create tag # this is required for the build scripts
48+
# run: |
49+
# git config user.name "${{ github.actor }}"
50+
# git config user.email "[email protected]"
51+
# git tag -a "v${{ github.event.inputs.version }}" -m "v${{ github.event.inputs.version }}"
52+
# git push origin "v${{ github.event.inputs.version }}"
53+
# - name: Package deb
54+
# run: |
55+
# ./script/package-deb
56+
# # many need to remove this once release-notes compilation is automated
57+
# - name: Rename deb artifact
58+
# run: |
59+
# for file in dist/github-backup-utils_*_all.deb; do
60+
# if [[ -f "$file" ]]; then
61+
# mv "$file" "dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb"
62+
# fi
63+
# done
64+
# - name: Upload deb artifact
65+
# uses: actions/upload-artifact@v3
66+
# with:
67+
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
68+
# path: |
69+
# dist/github-backup-utils_${{ github.event.inputs.version }}_all.deb
70+
# - name: Package tarball
71+
# run: |
72+
# ./script/package-tarball
73+
# - name: Upload tarball artifact
74+
# uses: actions/upload-artifact@v3
75+
# with:
76+
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
77+
# path: |
78+
# dist/github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
79+
# release:
80+
# needs: build
81+
# runs-on: ubuntu-latest
82+
# outputs:
83+
# commit_hash: ${{ steps.empty-commit.outputs.commit_hash }}
84+
# steps:
85+
# # resulting token still gets denied by the backup-utils repo
86+
# # see: https://github.com/actions/create-github-app-token/pull/46
87+
# # - uses: timreimherr/create-github-app-token@main
88+
# # id: app-token
89+
# # with:
90+
# # app_id: ${{ vars.RELEASE_CONTROLLER_APP_ID }}
91+
# # private_key: ${{ secrets.RELEASE_CONTROLLER_APP_PRIVATE_KEY }}
92+
# # owner: ${{ github.repository_owner }}
93+
# # repositories: backup-utils,backup-utils-private
94+
# - name: Checkout backup-utils
95+
# uses: actions/checkout@v4
96+
# with:
97+
# token: ${{ github.event.inputs.gh-token }}
98+
# repository: github/backup-utils
99+
# ref: master
100+
# - name: Create empty commit
101+
# uses: stefanzweifel/git-auto-commit-action@v4
102+
# id: empty-commit
103+
# with:
104+
# branch: master
105+
# commit_message: "${{ github.event.inputs.version }} release"
106+
# commit_user_name: "${{ github.actor }}"
107+
# commit_user_email: "[email protected]"
108+
# commit_options: "--allow-empty"
109+
# skip_dirty_check: true
110+
# - name: Download deb artifact
111+
# uses: actions/download-artifact@v3
112+
# with:
113+
# name: github-backup-utils_${{ github.event.inputs.version }}_all.deb
114+
# - name: Download tarball artifact
115+
# uses: actions/download-artifact@v3
116+
# with:
117+
# name: github-backup-utils-v${{ github.event.inputs.version }}.tar.gz
118+
# - name: Create Release
119+
# uses: ncipollo/release-action@v1
120+
# with:
121+
# token: ${{ github.event.inputs.gh-token }}
122+
# repo: backup-utils
123+
# name: |
124+
# GitHub Enterprise Server Backup Utilities v${{ github.event.inputs.version }}
125+
# artifacts: |
126+
# github-backup-utils-v${{ github.event.inputs.version }}.tar.gz, \
127+
# github-backup-utils_${{ github.event.inputs.version }}_all.deb
128+
# tag: v${{ github.event.inputs.version }}
129+
# commit: ${{ steps.empty-commit.outputs.commit_hash }}
130+
# bodyFile: release-notes/${{ github.event.inputs.version }}.md
131+
# draft: ${{ github.event.inputs.draft }}
132+
# allowUpdates: true
133+
# artifactContentType: "raw"
131134

132135

133136

0 commit comments

Comments
 (0)