Skip to content

Commit 5ba3202

Browse files
Merge pull request #216 from statisticsnorway/use-env-in-workflows
Use env in workflows
2 parents f171732 + 429f99f commit 5ba3202

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

.github/workflows/test-and-build.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,16 @@ jobs:
9696
steps:
9797
- name: Call workflow
9898
uses: actions/github-script@v7
99+
env:
100+
INTEGRATION_TEST_REPO: ${{ secrets.INTEGRATION_TEST_REPO }}
101+
INTEGRATION_TEST_WORKFLOW: "${{ secrets.INTEGRATION_TEST_WORKFLOW }}.yaml"
99102
with:
100103
github-token: ${{ secrets.INTEGRATION_TEST_PAT }}
101104
script: |
102105
await github.rest.actions.createWorkflowDispatch({
103106
owner: 'statisticsnorway',
104-
repo: '${{ secrets.INTEGRATION_TEST_REPO }}',
105-
workflow_id: '${{ secrets.INTEGRATION_TEST_WORKFLOW }}.yaml',
107+
repo: process.env.INTEGRATION_TEST_REPO,
108+
workflow_id: process.env.INTEGRATION_TEST_WORKFLOW,
106109
ref: 'main'
107110
})
108111
@@ -137,13 +140,16 @@ jobs:
137140
steps:
138141
- name: Call workflow
139142
uses: actions/github-script@v7
143+
env:
144+
DEPLOY_REPO: ${{ secrets.DEPLOY_REPO }}
145+
DEPLOY_WORKFLOW: "${{ secrets.DEPLOY_WORKFLOW }}.yaml"
140146
with:
141147
github-token: ${{ secrets.DEPLOY_PAT }}
142148
script: |
143149
await github.rest.actions.createWorkflowDispatch({
144150
owner: 'statisticsnorway',
145-
repo: '${{ secrets.DEPLOY_REPO }}',
146-
workflow_id: '${{ secrets.DEPLOY_WORKFLOW }}.yaml',
151+
repo: process.env.DEPLOY_REPO,
152+
workflow_id: process.env.DEPLOY_WORKFLOW,
147153
ref: 'master',
148154
inputs: {
149155
environment: "PROD",

.github/workflows/update-tools-version.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,28 @@ jobs:
4646
4747
- name: Update Microdata Tools Dependency
4848
if: steps.check_version.outputs.new_version
49+
env:
50+
NEW_VERSION: ${{ steps.check_version.outputs.new_version }}
4951
run: |
5052
git config --global user.name 'github-actions'
5153
git config --global user.email 'github-actions@github.com'
5254
git pull origin main
53-
git checkout -b bump-microdata-tools-${{ steps.check_version.outputs.new_version }}
54-
uv add 'microdata-tools==${{ steps.check_version.outputs.new_version }}'
55+
git checkout -b "bump-microdata-tools-$NEW_VERSION"
56+
uv add "microdata-tools==$NEW_VERSION"
5557
git add pyproject.toml uv.lock
56-
git commit -m "Update microdata-tools to ${{ steps.check_version.outputs.new_version }}"
57-
git push origin bump-microdata-tools-${{ steps.check_version.outputs.new_version }}
58+
git commit -m "Update microdata-tools to $NEW_VERSION"
59+
git push origin "bump-microdata-tools-$NEW_VERSION"
5860
5961
- name: Create Pull Request
6062
if: steps.check_version.outputs.new_version
63+
env:
64+
NEW_VERSION: ${{ steps.check_version.outputs.new_version }}
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6166
run: |
6267
gh pr create \
6368
--base main \
64-
--head bump-microdata-tools-${{ steps.check_version.outputs.new_version }} \
65-
--title "Update microdata-tools to ${{ steps.check_version.outputs.new_version }}" \
66-
--body "This PR updates microdata-tools to version ${{ steps.check_version.outputs.new_version }}."
69+
--head "bump-microdata-tools-$NEW_VERSION" \
70+
--title "Update microdata-tools to $NEW_VERSION" \
71+
--body "This PR updates microdata-tools to version $NEW_VERSION."
6772
# --reviewer statisticsnorway/microdata-developers # Reviwer not found [should work according to docs](https://cli.github.com/manual/gh_pr_create)
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+

0 commit comments

Comments
 (0)