-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add community PRs GH action workflow
- Loading branch information
1 parent
be8cf1b
commit 8dceafd
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: openshift community pull requests | ||
on: [push] | ||
jobs: | ||
create-community-pr: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: create github token | ||
uses: actions/create-github-app-token@v1.6.2 | ||
id: app-token | ||
with: | ||
app-id: ${{vars.GH_APP_ID}} | ||
private-key: ${{secrets.GH_APP_PRIVATE_KEY}} | ||
- name: sync fork | ||
env: | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: | | ||
gh repo sync DataDog/community-operators \ | ||
--source k8s-operatorhub/community-operators \ | ||
--force | ||
- name: checkout fork | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: DataDog/community-operators | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: checkout datadog-operator to tmp/ dir | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: Datadog/datadog-operator | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
path: tmp/ | ||
- name: update bundle | ||
run: | | ||
mkdir operators/datadog-operator/test-version | ||
cp -R ./tmp/bundle/* operators/datadog-operator/test-version | ||
- name: Configure git user | ||
run: | | ||
git config user.name ${{vars.GITHUB_ACTOR}} | ||
git config user.email ${{vars.GITHUB_ACTOR_ID}}+${{vars.GITHUB_ACTOR}}@users.noreply.github.com | ||
- name: create PR | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: | | ||
message="test PR" | ||
body="test PR" | ||
branch="community-prs-new" | ||
git checkout -b $branch | ||
git add -A | ||
git commit -s -m "$message" | ||
git push -f --set-upstream origin $branch | ||
gh pr create --title "$message" \ | ||
--body "$body" \ | ||
--repo DataDog/community-operators \ | ||
--base main \ | ||
--draft |