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
name: openshift community pull requests | |
on: [push] | |
jobs: | |
create-community-pr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
GH_REF_NAME: vX.Y.Z | |
BRANCH_NAME_BASE: ${{ github.actor }}/datadog-operator | |
ACTIONS_RUNNER_DEBUG: true | |
steps: | |
- name: setup env | |
run: | | |
echo "VERSION=${GH_REF_NAME:1:5}" >> $GITHUB_ENV | |
echo "COMMUNITY_BRANCH_NAME=$BRANCH_NAME_BASE-$GH_REF_NAME" >> $GITHUB_ENV | |
- name: validate env | |
run: | | |
echo "$VERSION" | |
echo "$COMMUNITY_BRANCH_NAME" | |
- name: create github token | |
uses: actions/[email protected] | |
id: app-token | |
with: | |
app-id: ${{vars.GH_APP_ID}} | |
private-key: ${{secrets.GH_APP_PRIVATE_KEY}} | |
repositories: "datadog-operator,community-operators" | |
- name: checkout fork | |
uses: actions/checkout@v4 | |
with: | |
repository: DataDog/community-operators | |
token: ${{ steps.app-token.outputs.token }} | |
- name: sync fork | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
run: | | |
gh repo sync DataDog/community-operators --branch release \ | |
--source k8s-operatorhub/community-operators \ | |
--force | |
- name: checkout datadog-operator to tmp/ dir | |
uses: actions/checkout@v4 | |
with: | |
repository: Datadog/datadog-operator | |
token: ${{ steps.app-token.outputs.token }} | |
path: tmp/ | |
- name: update bundle | |
run: | | |
mkdir operators/datadog-operator/$VERSION | |
cp -R ./tmp/bundle/* operators/datadog-operator/$VERSION | |
rm -rf ./tmp | |
- name: Configure git user | |
run: | | |
git config --global user.name ${{ github.actor }} | |
git config --global user.email ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com | |
- name: create PR | |
env: | |
GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
run: | | |
message="operator datadog-operator ($VERSION)" | |
body="operator datadog-operator ($VERSION)" | |
git checkout -b $COMMUNITY_BRANCH_NAME | |
git add -A | |
git commit -s -m "$message" | |
git push -f --set-upstream origin $COMMUNITY_BRANCH_NAME | |
gh pr create --title "$message" \ | |
--body "$body" \ | |
--repo k8s-operatorhub/community-operators \ | |
--base main \ | |
--draft | |
# - name: sync fork | |
# env: | |
# GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
# run: | | |
## git checkout -b $COMMUNITY_BRANCH_NAME | |
## git push -f --set-upstream origin $COMMUNITY_BRANCH_NAME | |
## gh repo sync DataDog/community-operators --branch $COMMUNITY_BRANCH_NAME \ | |
## --source k8s-operatorhub/community-operators \ | |
## --force | |
# gh repo sync DataDog/community-operators --branch release \ | |
# --source k8s-operatorhub/community-operators \ | |
# --force |