I've started playing with GitHub actions, but I'm struggling with accessing repository secrets which I pass as env's.
My workflow file:
name: Invite
on:
pull_request:
branches: [master]
types: [closed]
jobs:
invite:
runs-on: ubuntu-latest
steps:
- name: Hello world action
uses: lekterable/inclusive-organization-action@master
env:
SECRET_TOKEN: ${{ secrets.SECRET_TOKEN }}
organization: string
SUPER_SECRET: ${{ secrets.SUPER_SECRET }}
action index file
const core = require('@actions/core')
const github = require('@actions/github')
const run = async () => {
try {
...
console.log('env', process.env)
const token = process.env.SECRET_TOKEN
const secret = process.env.SUPER_SECRET
const organization = process.env.organization
console.log('organization', organization)
console.log('token?', !!token)
console.log('secret?', !!secret)
console.log('token length', token.length)
...
} catch (error) {
core.setFailed(error.message)
}
}
run()
as you can see I'm passing 3 env's, the organization which has a value of 'string' exists as expected, but SECRET_TOKEN and SUPER_SECRET are empty.
And yes, I do have the secrets set in the repo which runs the action:
Is there something that I'm doing wrong?
npm run build
to update your changes? to./dist/index.js
, ive essentially setup the same and having no issues, github.com/lcherone/gh-actions/commit/… the secret env var (process.env.foo) won't show its values but it is 10 chars long. I'm thinking now you just have old code in ./dist.